From 60ae3a8a4f73cc33c7477edc10483ef076b5932b Mon Sep 17 00:00:00 2001 From: Luis Ramos Date: Fri, 26 Mar 2021 22:37:54 +0000 Subject: [PATCH] Fix rspec syntax --- .../admin/proxy_orders_controller_spec.rb | 8 ++++---- spec/controllers/admin/schedules_controller_spec.rb | 8 ++++---- .../admin/stripe_accounts_controller_spec.rb | 12 ++++++------ 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/spec/controllers/admin/proxy_orders_controller_spec.rb b/spec/controllers/admin/proxy_orders_controller_spec.rb index d98eccabeb..bd4145015e 100644 --- a/spec/controllers/admin/proxy_orders_controller_spec.rb +++ b/spec/controllers/admin/proxy_orders_controller_spec.rb @@ -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 diff --git a/spec/controllers/admin/schedules_controller_spec.rb b/spec/controllers/admin/schedules_controller_spec.rb index 2718d75b65..544d31050d 100644 --- a/spec/controllers/admin/schedules_controller_spec.rb +++ b/spec/controllers/admin/schedules_controller_spec.rb @@ -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 diff --git a/spec/controllers/admin/stripe_accounts_controller_spec.rb b/spec/controllers/admin/stripe_accounts_controller_spec.rb index 3774c47921..bca1d2444e 100644 --- a/spec/controllers/admin/stripe_accounts_controller_spec.rb +++ b/spec/controllers/admin/stripe_accounts_controller_spec.rb @@ -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