mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-01-24 20:36:49 +00:00
Fix rspec syntax
This commit is contained in:
@@ -42,7 +42,7 @@ describe Admin::ProxyOrdersController, type: :controller do
|
||||
|
||||
context "when cancellation succeeds" do
|
||||
it 'renders the cancelled proxy_order as json' do
|
||||
get :cancel, params
|
||||
get :cancel, params: params
|
||||
json_response = JSON.parse(response.body)
|
||||
expect(json_response['state']).to eq "canceled"
|
||||
expect(json_response['id']).to eq proxy_order.id
|
||||
@@ -54,7 +54,7 @@ describe Admin::ProxyOrdersController, type: :controller do
|
||||
before { order_cycle.update(orders_close_at: 1.day.ago) }
|
||||
|
||||
it "shows an error" do
|
||||
get :cancel, params
|
||||
get :cancel, params: params
|
||||
json_response = JSON.parse(response.body)
|
||||
expect(json_response['errors']).to eq ['Could not cancel the order']
|
||||
end
|
||||
@@ -111,7 +111,7 @@ describe Admin::ProxyOrdersController, type: :controller do
|
||||
|
||||
context "when resuming succeeds" do
|
||||
it 'renders the resumed proxy_order as json' do
|
||||
get :resume, params
|
||||
get :resume, params: params
|
||||
json_response = JSON.parse(response.body)
|
||||
expect(json_response['state']).to eq "resumed"
|
||||
expect(json_response['id']).to eq proxy_order.id
|
||||
@@ -123,7 +123,7 @@ describe Admin::ProxyOrdersController, type: :controller do
|
||||
before { order_cycle.update(orders_close_at: 1.day.ago) }
|
||||
|
||||
it "shows an error" do
|
||||
get :resume, params
|
||||
get :resume, params: params
|
||||
json_response = JSON.parse(response.body)
|
||||
expect(json_response['errors']).to eq ['Could not resume the order']
|
||||
end
|
||||
|
||||
@@ -21,13 +21,13 @@ describe Admin::SchedulesController, type: :controller do
|
||||
let(:params) { { format: :json } }
|
||||
|
||||
it "scopes @collection to schedules containing order_cycles coordinated by enterprises I manage" do
|
||||
get :index, params
|
||||
get :index, params: params
|
||||
expect(assigns(:collection)).to eq [coordinated_schedule]
|
||||
end
|
||||
|
||||
it "serializes the data" do
|
||||
expect(ActiveModel::ArraySerializer).to receive(:new)
|
||||
get :index, params
|
||||
get :index, params: params
|
||||
end
|
||||
|
||||
context "and there is a schedule of an OC coordinated by _another_ enterprise I manage and the first enterprise is given" do
|
||||
@@ -37,7 +37,7 @@ describe Admin::SchedulesController, type: :controller do
|
||||
let(:params) { { format: :json, enterprise_id: managed_coordinator.id } }
|
||||
|
||||
it "scopes @collection to schedules containing order_cycles coordinated by the first enterprise" do
|
||||
get :index, params
|
||||
get :index, params: params
|
||||
expect(assigns(:collection)).to eq [coordinated_schedule]
|
||||
end
|
||||
end
|
||||
@@ -45,7 +45,7 @@ describe Admin::SchedulesController, type: :controller do
|
||||
|
||||
context "where I dont manage an order cycle coordinator" do
|
||||
it "returns an empty collection" do
|
||||
get :index, format: :json
|
||||
get :index, as: :json
|
||||
expect(assigns(:collection)).to be_nil
|
||||
end
|
||||
end
|
||||
|
||||
@@ -15,7 +15,7 @@ describe Admin::StripeAccountsController, type: :controller do
|
||||
end
|
||||
|
||||
it "redirects to Stripe Authorization url constructed OAuth" do
|
||||
get :connect, enterprise_id: 1 # A deterministic id results in a deterministic state JWT token
|
||||
get :connect, params: { enterprise_id: 1 } # A deterministic id results in a deterministic state JWT token
|
||||
|
||||
expect(response).to redirect_to("https://connect.stripe.com/oauth/authorize?state=eyJhbGciOiJIUzI1NiJ9.eyJlbnRlcnByaXNlX2lkIjoiMSJ9.jSSFGn0bLhwuiQYK5ORmHWW7aay1l030bcfGwn1JbFg&scope=read_write&client_id=some_id&response_type=code")
|
||||
end
|
||||
@@ -98,7 +98,7 @@ describe Admin::StripeAccountsController, type: :controller do
|
||||
end
|
||||
|
||||
it "redirects to unauthorized" do
|
||||
get :status, params
|
||||
get :status, params: params
|
||||
expect(response).to redirect_to unauthorized_path
|
||||
end
|
||||
end
|
||||
@@ -110,7 +110,7 @@ describe Admin::StripeAccountsController, type: :controller do
|
||||
|
||||
context "when Stripe is not enabled" do
|
||||
it "returns with a status of 'stripe_disabled'" do
|
||||
get :status, params
|
||||
get :status, params: params
|
||||
json_response = JSON.parse(response.body)
|
||||
expect(json_response["status"]).to eq "stripe_disabled"
|
||||
end
|
||||
@@ -121,7 +121,7 @@ describe Admin::StripeAccountsController, type: :controller do
|
||||
|
||||
context "when no stripe account is associated with the specified enterprise" do
|
||||
it "returns with a status of 'account_missing'" do
|
||||
get :status, params
|
||||
get :status, params: params
|
||||
json_response = JSON.parse(response.body)
|
||||
expect(json_response["status"]).to eq "account_missing"
|
||||
end
|
||||
@@ -136,7 +136,7 @@ describe Admin::StripeAccountsController, type: :controller do
|
||||
end
|
||||
|
||||
it "returns with a status of 'access_revoked'" do
|
||||
get :status, params
|
||||
get :status, params: params
|
||||
json_response = JSON.parse(response.body)
|
||||
expect(json_response["status"]).to eq "access_revoked"
|
||||
end
|
||||
@@ -157,7 +157,7 @@ describe Admin::StripeAccountsController, type: :controller do
|
||||
end
|
||||
|
||||
it "returns with a status of 'connected'" do
|
||||
get :status, params
|
||||
get :status, params: params
|
||||
json_response = JSON.parse(response.body)
|
||||
expect(json_response["status"]).to eq "connected"
|
||||
# serializes required attrs
|
||||
|
||||
Reference in New Issue
Block a user