mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-02-04 22:16:08 +00:00
Replace spree_get with simple call to get
This commit is contained in:
@@ -20,7 +20,7 @@ describe Admin::BulkLineItemsController, type: :controller do
|
||||
before { allow(controller).to receive_messages spree_current_user: create(:user) }
|
||||
|
||||
it "should deny me access to the index action" do
|
||||
spree_get :index, format: :json
|
||||
get :index, format: :json
|
||||
expect(response).to redirect_to unauthorized_path
|
||||
end
|
||||
end
|
||||
@@ -32,7 +32,7 @@ describe Admin::BulkLineItemsController, type: :controller do
|
||||
|
||||
context "when no ransack params are passed in" do
|
||||
before do
|
||||
spree_get :index, format: :json
|
||||
get :index, format: :json
|
||||
end
|
||||
|
||||
it "retrieves a list of line_items with appropriate attributes, including line items with appropriate attributes" do
|
||||
@@ -56,7 +56,7 @@ describe Admin::BulkLineItemsController, type: :controller do
|
||||
|
||||
context "when ransack params are passed in for line items" do
|
||||
before do
|
||||
spree_get :index, format: :json, q: { order_id_eq: order2.id }
|
||||
get :index, format: :json, q: { order_id_eq: order2.id }
|
||||
end
|
||||
|
||||
it "retrives a list of line items which match the criteria" do
|
||||
@@ -66,7 +66,7 @@ describe Admin::BulkLineItemsController, type: :controller do
|
||||
|
||||
context "when ransack params are passed in for orders" do
|
||||
before do
|
||||
spree_get :index, format: :json, q: { order: { completed_at_gt: 2.hours.ago } }
|
||||
get :index, format: :json, q: { order: { completed_at_gt: 2.hours.ago } }
|
||||
end
|
||||
|
||||
it "retrives a list of line items whose orders match the criteria" do
|
||||
@@ -90,7 +90,7 @@ describe Admin::BulkLineItemsController, type: :controller do
|
||||
context "producer enterprise" do
|
||||
before do
|
||||
allow(controller).to receive_messages spree_current_user: supplier.owner
|
||||
spree_get :index, format: :json
|
||||
get :index, format: :json
|
||||
end
|
||||
|
||||
it "does not display line items for which my enterprise is a supplier" do
|
||||
@@ -101,7 +101,7 @@ describe Admin::BulkLineItemsController, type: :controller do
|
||||
context "coordinator enterprise" do
|
||||
before do
|
||||
allow(controller).to receive_messages spree_current_user: coordinator.owner
|
||||
spree_get :index, format: :json
|
||||
get :index, format: :json
|
||||
end
|
||||
|
||||
it "retrieves a list of line_items" do
|
||||
@@ -113,7 +113,7 @@ describe Admin::BulkLineItemsController, type: :controller do
|
||||
context "hub enterprise" do
|
||||
before do
|
||||
allow(controller).to receive_messages spree_current_user: distributor1.owner
|
||||
spree_get :index, format: :json
|
||||
get :index, format: :json
|
||||
end
|
||||
|
||||
it "retrieves a list of line_items" do
|
||||
@@ -130,7 +130,7 @@ describe Admin::BulkLineItemsController, type: :controller do
|
||||
|
||||
context "with pagination args" do
|
||||
it "returns paginated results" do
|
||||
spree_get :index, { page: 1, per_page: 2 }, format: :json
|
||||
get :index, { page: 1, per_page: 2 }, format: :json
|
||||
|
||||
expect(line_item_ids).to eq [line_item1.id, line_item2.id]
|
||||
expect(json_response['pagination']).to eq(
|
||||
@@ -139,7 +139,7 @@ describe Admin::BulkLineItemsController, type: :controller do
|
||||
end
|
||||
|
||||
it "returns paginated results for a second page" do
|
||||
spree_get :index, { page: 2, per_page: 2 }, format: :json
|
||||
get :index, { page: 2, per_page: 2 }, format: :json
|
||||
|
||||
expect(line_item_ids).to eq [line_item3.id, line_item4.id]
|
||||
expect(json_response['pagination']).to eq(
|
||||
|
||||
Reference in New Issue
Block a user