Skip to content

A platform for community discussion. Free, open, simple.

FIX: change around to after in flag spec (#27168)

Krzysztof Kotlarek99e27c4fd5ce
diff --git a/spec/models/flag_spec.rb b/spec/models/flag_spec.rb
index ff26f05d474..1f40c7d3e5e 100644
--- a/spec/models/flag_spec.rb
+++ b/spec/models/flag_spec.rb
@@ -1,21 +1,19 @@
# frozen_string_literal: true
RSpec.describe Flag, type: :model do
- around do |test|
- Flag.reset_flag_settings!
- test.call
- Flag.reset_flag_settings!
- end
+ after(:each) { Flag.reset_flag_settings! }
it "has id lower than 1000 for system flags" do
flag = Fabricate(:flag, id: 1)
expect(flag.system?).to be true
+ flag.destroy!
end
it "has id greater than 1000 for non-system flags" do
flag = Fabricate(:flag)
expect(flag.system?).to be false
expect(flag.id).to be > 1000
+ flag.destroy!
end
it "has correct name key" do
@@ -27,6 +25,8 @@ RSpec.describe Flag, type: :model do
flag.update!(name: "THIS IS SPaM!+)(*&^%$#@@@!)")
expect(flag.name_key).to eq("this_is_spam")
+
+ flag.destroy!
end
it "updates post action types when created, modified or destroyed" do