DEV: Fix flaky specs related to flag services
Creating or updating flags generates global side effects. Sometimes it seems the state can leak from the flag specs. This is probably related to the use of `fab!`. This patch replaces those calls with standard `let`s. While the overall performances of these tests will be a little less good, their state should not leak anymore.
This commit is contained in:
parent
fe4e2a17cb
commit
64605519da
|
@ -3,9 +3,9 @@
|
|||
RSpec.describe(Flags::DestroyFlag) do
|
||||
subject(:result) { described_class.call(**params, **dependencies) }
|
||||
|
||||
fab!(:flag)
|
||||
fab!(:current_user) { Fabricate(:admin) }
|
||||
|
||||
let(:flag) { Fabricate(:flag) }
|
||||
let(:params) { { id: flag_id } }
|
||||
let(:dependencies) { { guardian: current_user.guardian } }
|
||||
let(:flag_id) { flag.id }
|
||||
|
|
|
@ -8,9 +8,9 @@ RSpec.describe(Flags::ToggleFlag) do
|
|||
describe ".call" do
|
||||
subject(:result) { described_class.call(**params, **dependencies) }
|
||||
|
||||
fab!(:flag)
|
||||
fab!(:current_user) { Fabricate(:admin) }
|
||||
|
||||
let(:flag) { Fabricate(:flag) }
|
||||
let(:flag_id) { flag.id }
|
||||
let(:params) { { flag_id: flag_id } }
|
||||
let(:dependencies) { { guardian: current_user.guardian } }
|
||||
|
|
|
@ -13,9 +13,9 @@ RSpec.describe(Flags::UpdateFlag) do
|
|||
describe ".call" do
|
||||
subject(:result) { described_class.call(**params, **dependencies) }
|
||||
|
||||
fab!(:flag)
|
||||
fab!(:current_user) { Fabricate(:admin) }
|
||||
|
||||
let(:flag) { Fabricate(:flag) }
|
||||
let(:params) { { id: flag_id, name:, description:, applies_to:, require_message:, enabled: } }
|
||||
let(:dependencies) { { guardian: current_user.guardian } }
|
||||
let(:flag_id) { flag.id }
|
||||
|
|
Loading…
Reference in New Issue