Remove redundant setting resets in after blocks
Settings are stored in the database, and so any changes to the settings done during the tests are automatically rolled back between one test and the next one. There were also a few places where we weren't using an `after` block but changing the setting at the end of the test.
This commit is contained in:
@@ -13,22 +13,12 @@ describe InstallationController, type: :request do
|
||||
let(:seeds_feature_settings) { Setting.where("key LIKE 'feature.%'") }
|
||||
|
||||
before do
|
||||
@current_feature_settings = seeds_feature_settings.pluck(:key, :value).to_h
|
||||
seeds_feature_settings.destroy_all
|
||||
test_feature_settings.each do |feature_name, feature_value|
|
||||
Setting["feature.#{feature_name}"] = feature_value
|
||||
end
|
||||
end
|
||||
|
||||
after do
|
||||
test_feature_settings.each_key do |feature_name|
|
||||
Setting.find_by(key: "feature.#{feature_name}").destroy
|
||||
end
|
||||
@current_feature_settings.each do |feature_name, feature_value|
|
||||
Setting[feature_name] = feature_value
|
||||
end
|
||||
end
|
||||
|
||||
specify "with query string inside query params" do
|
||||
get "/consul.json"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user