Files
nairobi/spec/controllers/installation_controller_spec.rb
Javi Martín da121ebc53 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.
2019-09-23 13:47:45 +02:00

31 lines
802 B
Ruby

require "rails_helper"
describe InstallationController, type: :request do
describe "consul.json" do
let(:test_feature_settings) do
{
"disabled_feature" => nil,
"enabled_feature" => "t"
}
end
let(:seeds_feature_settings) { Setting.where("key LIKE 'feature.%'") }
before do
seeds_feature_settings.destroy_all
test_feature_settings.each do |feature_name, feature_value|
Setting["feature.#{feature_name}"] = feature_value
end
end
specify "with query string inside query params" do
get "/consul.json"
expect(response).to have_http_status(:ok)
expect(JSON.parse(response.body)["release"]).not_to be_empty
expect(JSON.parse(response.body)["features"]).to eq(test_feature_settings)
end
end
end