Fix rspec syntax

This commit is contained in:
Luis Ramos
2021-03-26 22:29:50 +00:00
parent ad3745f032
commit f62f958a4c

View File

@@ -20,7 +20,7 @@ module Admin
context "html" do
it "doesn't load any data" do
get :index, format: :html
get :index, as: :html
expect(assigns(:collection)).to be_empty
end
end
@@ -28,7 +28,7 @@ module Admin
context "json" do
context "where ransack conditions are specified" do
it "loads order cycles that closed within the past month, and orders without a close_at date" do
get :index, format: :json
get :index, as: :json
expect(assigns(:collection)).to_not include oc1, oc2
expect(assigns(:collection)).to include oc3, oc4
end
@@ -38,7 +38,7 @@ module Admin
let(:q) { { orders_close_at_gt: 45.days.ago } }
it "loads order cycles that closed after the specified date, and orders without a close_at date" do
get :index, format: :json, q: q
get :index, as: :json, params: { q: q }
expect(assigns(:collection)).to_not include oc1
expect(assigns(:collection)).to include oc2, oc3, oc4
end
@@ -47,7 +47,7 @@ module Admin
before { q.merge!(id_not_in: [oc2.id, oc4.id]) }
it "loads order cycles that meet all conditions" do
get :index, format: :json, q: q
get :index, format: :json, params: { q: q }
expect(assigns(:collection)).to_not include oc1, oc2, oc4
expect(assigns(:collection)).to include oc3
end
@@ -80,14 +80,14 @@ module Admin
describe "and a coordinator_id is submitted as part of the request" do
describe "when the user manages the enterprise" do
it "renders the new template" do
get :new, coordinator_id: distributor1.id
get :new, params: { coordinator_id: distributor1.id }
expect(response).to render_template :new
end
end
describe "when the user does not manage the enterprise" do
it "renders the set_coordinator template and sets a flash error" do
get :new, coordinator_id: distributor3.id
get :new, params: { coordinator_id: distributor3.id }
expect(response).to render_template :set_coordinator
expect(flash[:error]).to eq "You don't have permission to create an order cycle coordinated by that enterprise"
end
@@ -101,7 +101,7 @@ module Admin
context "as a manager of a shop" do
let(:form_mock) { instance_double(OrderCycleForm) }
let(:params) { { format: :json, order_cycle: {} } }
let(:params) { { as: :json, order_cycle: {} } }
before do
controller_login_as_enterprise_user([shop])
@@ -336,7 +336,7 @@ module Admin
describe "when an order cycle is deleteable" do
it "allows the order_cycle to be destroyed" do
get :destroy, id: oc.id
get :destroy, params: { id: oc.id }
expect(OrderCycle.find_by(id: oc.id)).to be nil
end
end
@@ -345,7 +345,7 @@ module Admin
let!(:order) { create(:order, order_cycle: oc) }
it "displays an error message when we attempt to delete it" do
get :destroy, id: oc.id
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')
end
@@ -355,7 +355,7 @@ module Admin
let!(:schedule) { create(:schedule, order_cycles: [oc]) }
it "displays an error message when we attempt to delete it" do
get :destroy, id: oc.id
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')
end