mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-03-01 02:03:22 +00:00
Optimise spec
This commit is contained in:
@@ -291,7 +291,7 @@ describe Admin::EnterprisesController, type: :controller do
|
||||
describe "vouchers" do
|
||||
let(:enterprise) { create(:distributor_enterprise) }
|
||||
let!(:voucher_a) { create(:voucher, enterprise: enterprise, code: "voucher 1") }
|
||||
let!(:voucher_b) { create(:voucher, enterprise: enterprise, code: "voucher 2") }
|
||||
let(:voucher_b) { create(:voucher, enterprise: enterprise, code: "voucher 2") }
|
||||
|
||||
before do
|
||||
controller_login_as_enterprise_user [enterprise]
|
||||
@@ -319,10 +319,8 @@ describe Admin::EnterprisesController, type: :controller do
|
||||
expect(voucher_a.reload.deleted?).to be(true)
|
||||
end
|
||||
|
||||
context "when desactivating the only existing voucher" do
|
||||
context "when deactivating the only existing voucher" do
|
||||
it "deactivates the voucher" do
|
||||
voucher_b.really_destroy!
|
||||
|
||||
# Rails won't populate vouchers_id params if no voucher selected
|
||||
spree_put :update,
|
||||
id: enterprise,
|
||||
@@ -334,6 +332,7 @@ describe Admin::EnterprisesController, type: :controller do
|
||||
|
||||
context "when activating and deactivating voucher at the same time" do
|
||||
it "deactivates and activates accordingly" do
|
||||
voucher_b
|
||||
voucher_c = create(:voucher, enterprise: enterprise, code: "voucher 3")
|
||||
voucher_c.destroy
|
||||
|
||||
|
||||
Reference in New Issue
Block a user