mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-01-24 20:36:49 +00:00
Remive I18n keys in Admin ctrller specs
This commit is contained in:
@@ -23,7 +23,7 @@ module Admin
|
||||
spree_post :create, email: existing_user.email, enterprise_id: enterprise.id
|
||||
|
||||
expect(response.status).to eq 422
|
||||
expect(json_response['errors']).to eq I18n.t('admin.enterprises.invite_manager.user_already_exists')
|
||||
expect(json_response['errors']).to eq 'User already exists'
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -341,7 +341,7 @@ module Admin
|
||||
spree_put :bulk_update, format: :json
|
||||
end.to change(oc, :orders_open_at).by(0)
|
||||
json_response = JSON.parse(response.body)
|
||||
expect(json_response['errors']).to eq I18n.t('admin.order_cycles.bulk_update.no_data')
|
||||
expect(json_response['errors']).to eq 'Hm, something went wrong. No order cycle data found.'
|
||||
end
|
||||
|
||||
context "when a validation error occurs" do
|
||||
@@ -425,7 +425,7 @@ module Admin
|
||||
it "displays an error message when we attempt to delete it" do
|
||||
get :destroy, params: { id: oc.id }
|
||||
expect(response).to redirect_to admin_order_cycles_path
|
||||
expect(flash[:error]).to eq I18n.t('admin.order_cycles.destroy_errors.orders_present')
|
||||
expect(flash[:error]).to eq 'That order cycle has been selected by a customer and cannot be deleted. To prevent customers from accessing it, please close it instead.'
|
||||
end
|
||||
end
|
||||
|
||||
@@ -435,7 +435,7 @@ module Admin
|
||||
it "displays an error message when we attempt to delete it" do
|
||||
get :destroy, params: { id: oc.id }
|
||||
expect(response).to redirect_to admin_order_cycles_path
|
||||
expect(flash[:error]).to eq I18n.t('admin.order_cycles.destroy_errors.schedule_present')
|
||||
expect(flash[:error]).to eq 'That order cycle is linked to a schedule and cannot be deleted. Please unlink or delete the schedule first.'
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -255,7 +255,7 @@ describe Admin::SchedulesController, type: :controller do
|
||||
it "returns an error message and prevents me from deleting the schedule" do
|
||||
expect { spree_delete :destroy, params }.to_not change(Schedule, :count)
|
||||
json_response = JSON.parse(response.body)
|
||||
expect(json_response["errors"]).to include I18n.t('admin.schedules.destroy.associated_subscriptions_error')
|
||||
expect(json_response["errors"]).to include 'This schedule cannot be deleted because it has associated subscriptions'
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -463,7 +463,7 @@ describe Admin::SubscriptionsController, type: :controller do
|
||||
spree_put :cancel, params
|
||||
expect(response.status).to be 409
|
||||
json_response = JSON.parse(response.body)
|
||||
expect(json_response['errors']['open_orders']).to eq I18n.t('admin.subscriptions.confirm_cancel_open_orders_msg')
|
||||
expect(json_response['errors']['open_orders']).to eq 'Some orders for this subscription are currently open. The customer has already been notified that the order will be placed. Would you like to cancel these order(s) or keep them?'
|
||||
end
|
||||
end
|
||||
|
||||
@@ -564,7 +564,7 @@ describe Admin::SubscriptionsController, type: :controller do
|
||||
spree_put :pause, params
|
||||
expect(response.status).to be 409
|
||||
json_response = JSON.parse(response.body)
|
||||
expect(json_response['errors']['open_orders']).to eq I18n.t('admin.subscriptions.confirm_cancel_open_orders_msg')
|
||||
expect(json_response['errors']['open_orders']).to eq 'Some orders for this subscription are currently open. The customer has already been notified that the order will be placed. Would you like to cancel these order(s) or keep them?'
|
||||
end
|
||||
end
|
||||
|
||||
@@ -685,7 +685,7 @@ describe Admin::SubscriptionsController, type: :controller do
|
||||
spree_put :unpause, params
|
||||
expect(response.status).to be 409
|
||||
json_response = JSON.parse(response.body)
|
||||
expect(json_response['errors']['canceled_orders']).to eq I18n.t('admin.subscriptions.resume_canceled_orders_msg')
|
||||
expect(json_response['errors']['canceled_orders']).to eq 'Some orders for this subscription can be resumed right now. You can resume them from the orders dropdown.'
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -32,7 +32,7 @@ describe Admin::TermsOfServiceFilesController, type: :controller do
|
||||
it "redirects and show an error" do
|
||||
post :create, params: {}
|
||||
expect(response).to redirect_to admin_terms_of_service_files_path
|
||||
expect(flash[:error]).to eq I18n.t(".admin.terms_of_service_files.create.select_file")
|
||||
expect(flash[:error]).to eq 'Please select a file first.'
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user