mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-02-11 23:17:48 +00:00
Fixes RSpecRails HaveHttpStatus cop in admin specs
This commit is contained in:
@@ -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'
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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. ' \
|
||||
|
||||
Reference in New Issue
Block a user