mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-02-27 01:43:22 +00:00
Create only used test data
The `params` and the user are created before the request. But, for example, the enterprise user doesn't need creating when testing permissions of the normal user.
This commit is contained in:
committed by
Mohamed ABDELLANI
parent
3a9a023dea
commit
145696aa7f
@@ -106,13 +106,13 @@ describe Spree::Admin::OrdersController, type: :controller do
|
||||
end
|
||||
|
||||
describe "#index" do
|
||||
let!(:user) { create(:user) }
|
||||
let!(:enterprise_user) { create(:user) }
|
||||
let!(:order) {
|
||||
let(:user) { create(:user) }
|
||||
let(:enterprise_user) { create(:user) }
|
||||
let(:order) {
|
||||
create(:order_with_distributor, bill_address: create(:address),
|
||||
ship_address: create(:address))
|
||||
}
|
||||
let!(:distributor) { order.distributor }
|
||||
let(:distributor) { order.distributor }
|
||||
let(:params) { { id: order.number } }
|
||||
|
||||
context "as a normal user" do
|
||||
@@ -133,6 +133,7 @@ describe Spree::Admin::OrdersController, type: :controller do
|
||||
expect(response).to redirect_to unauthorized_path
|
||||
end
|
||||
end
|
||||
|
||||
context 'which is a manager of the distributor for an order' do
|
||||
before { allow(controller).to receive(:spree_current_user) { distributor.owner } }
|
||||
|
||||
|
||||
Reference in New Issue
Block a user