Files
nairobi/spec/controllers/installation_controller_spec.rb
Javi Martín 201e23da3d Describe enabled processes in the consul.json URL
The idea to show the status of the existing features was done in commit
7339a98b74. Back then, we didn't have the separate `process.` prefix,
and so processes were enabled/disabled using settings like
`feature.debates` instead of `process.debates`.

IMHO making the information about the enabled features public could
potentially be a bit risky since it gives too much information about the
current status of the application.

Showing which processes are enabled, on the other hand, is pretty
harmless, and it's the reason why this feature was added in the first
place.
2022-06-02 17:10:38 +02:00

30 lines
801 B
Ruby

require "rails_helper"
describe InstallationController, type: :request do
describe "consul.json" do
let(:test_process_settings) do
{
"disabled_process" => nil,
"enabled_process" => "t"
}
end
let(:seeds_process_settings) { Setting.where("key LIKE 'process.%'") }
before do
seeds_process_settings.destroy_all
test_process_settings.each do |feature_name, feature_value|
Setting["process.#{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_process_settings)
end
end
end