Skip to content

Commit 6f9c186

Browse files
committed
Add config_override macro to 7.4 branch... Cherry picked from: c7b5887
1 parent 494bf47 commit 6f9c186

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

spec/support/macros.rb

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,5 +16,17 @@ def use_spec_mongoid_config
1616
end
1717
end
1818
end
19+
20+
def config_override(key, value)
21+
around do |example|
22+
existing = Mongoid.send(key)
23+
24+
Mongoid.send("#{key}=", value)
25+
26+
example.run
27+
28+
Mongoid.send("#{key}=", existing)
29+
end
30+
end
1931
end
2032
end

0 commit comments

Comments
 (0)