diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index 301c7bd716..315d63885b 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -221,15 +221,12 @@ Metrics/PerceivedComplexity: - 'app/models/spree/ability.rb' - 'app/models/spree/order/checkout.rb' -# Offense count: 144 +# Offense count: 137 # This cop supports unsafe autocorrection (--autocorrect-all). # Configuration parameters: ResponseMethods. # ResponseMethods: response, last_response RSpecRails/HaveHttpStatus: Exclude: - - 'spec/controllers/admin/bulk_line_items_controller_spec.rb' - - 'spec/controllers/admin/order_cycles_controller_spec.rb' - - 'spec/controllers/admin/subscriptions_controller_spec.rb' - 'spec/controllers/api/v0/base_controller_spec.rb' - 'spec/controllers/api/v0/customers_controller_spec.rb' - 'spec/controllers/api/v0/enterprises_controller_spec.rb' diff --git a/spec/controllers/admin/bulk_line_items_controller_spec.rb b/spec/controllers/admin/bulk_line_items_controller_spec.rb index 23e42284ac..a69798da31 100644 --- a/spec/controllers/admin/bulk_line_items_controller_spec.rb +++ b/spec/controllers/admin/bulk_line_items_controller_spec.rb @@ -254,7 +254,7 @@ RSpec.describe Admin::BulkLineItemsController, type: :controller do it 'returns a 204 response' do spree_put :update, params - expect(response.status).to eq 204 + expect(response).to have_http_status :no_content end it 'applies enterprise fees locking the order with an exclusive row lock' do @@ -280,7 +280,7 @@ RSpec.describe Admin::BulkLineItemsController, type: :controller do it 'returns a 412 response' do spree_put :update, params - expect(response.status).to eq 412 + expect(response).to have_http_status :precondition_failed end end end @@ -341,7 +341,7 @@ RSpec.describe Admin::BulkLineItemsController, type: :controller do it 'returns a 204 response' do spree_delete :destroy, params - expect(response.status).to eq 204 + expect(response).to have_http_status :no_content end end end diff --git a/spec/controllers/admin/order_cycles_controller_spec.rb b/spec/controllers/admin/order_cycles_controller_spec.rb index 300b7aba89..59f848f53e 100644 --- a/spec/controllers/admin/order_cycles_controller_spec.rb +++ b/spec/controllers/admin/order_cycles_controller_spec.rb @@ -241,7 +241,7 @@ module Admin it "can update order cycle even if the variant has been deleted" do spree_put :update, { format: :json, id: order_cycle.id, order_cycle: {} } - expect(response.status).to eq 200 + expect(response).to have_http_status :ok end end diff --git a/spec/controllers/admin/subscriptions_controller_spec.rb b/spec/controllers/admin/subscriptions_controller_spec.rb index b0afd0993d..a929c9509c 100644 --- a/spec/controllers/admin/subscriptions_controller_spec.rb +++ b/spec/controllers/admin/subscriptions_controller_spec.rb @@ -463,7 +463,7 @@ RSpec.describe Admin::SubscriptionsController, type: :controller do context "when no 'open_orders' directive has been provided" do it "renders an error, asking what to do" do spree_put :cancel, params - expect(response.status).to be 409 + expect(response).to have_http_status :conflict json_response = response.parsed_body expect(json_response['errors']['open_orders']) .to eq 'Some orders for this subscription are currently open. ' \ @@ -567,7 +567,7 @@ RSpec.describe Admin::SubscriptionsController, type: :controller do context "when no 'open_orders' directive has been provided" do it "renders an error, asking what to do" do spree_put :pause, params - expect(response.status).to be 409 + expect(response).to have_http_status :conflict json_response = response.parsed_body expect(json_response['errors']['open_orders']) .to eq 'Some orders for this subscription are currently open. ' \ @@ -690,7 +690,7 @@ RSpec.describe Admin::SubscriptionsController, type: :controller do context "when no 'canceled_orders' directive has been provided" do it "renders a message, informing the user that canceled order can be resumed" do spree_put :unpause, params - expect(response.status).to be 409 + expect(response).to have_http_status :conflict json_response = response.parsed_body expect(json_response['errors']['canceled_orders']) .to eq 'Some orders for this subscription can be resumed right now. ' \