DEV: flaky flags specs (#27362)

When flags are modified, we always need to reset the state to the original values.
This commit is contained in:
Krzysztof Kotlarek 2024-06-06 09:40:14 +10:00 committed by GitHub
parent 343430fe77
commit 593a9b05cd
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 8 additions and 0 deletions

View File

@ -31,6 +31,10 @@ RSpec.describe(ReorderFlag) do
context "when user is allowed to perform the action" do context "when user is allowed to perform the action" do
fab!(:current_user) { Fabricate(:admin) } fab!(:current_user) { Fabricate(:admin) }
after do
described_class.call(flag_id: flag.id, guardian: current_user.guardian, direction: "down")
end
it "sets the service result as successful" do it "sets the service result as successful" do
expect(result).to be_a_success expect(result).to be_a_success
end end

View File

@ -14,6 +14,8 @@ RSpec.describe(ToggleFlag) do
context "when user is allowed to perform the action" do context "when user is allowed to perform the action" do
fab!(:current_user) { Fabricate(:admin) } fab!(:current_user) { Fabricate(:admin) }
after { flag.update!(enabled: true) }
it "sets the service result as successful" do it "sets the service result as successful" do
expect(result).to be_a_success expect(result).to be_a_success
end end

View File

@ -25,6 +25,8 @@ describe "Admin Flags Page", type: :system do
expect(all(".flag-action-type-details strong").map(&:text)).to eq( expect(all(".flag-action-type-details strong").map(&:text)).to eq(
["Something Else", "It's Inappropriate", "It's Illegal"], ["Something Else", "It's Inappropriate", "It's Illegal"],
) )
Flag.system.where(name: "spam").update!(enabled: true)
end end
it "allows admin to change order of flags" do it "allows admin to change order of flags" do