diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 1304689c5..f61729b5a 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -78,6 +78,18 @@ RSpec.configure do |config| sign_in(create(:administrator).user) end + config.before(:each, :show_exceptions) do + config = Rails.application.env_config + + allow(Rails.application).to receive(:env_config) do + config.merge( + "action_dispatch.show_exceptions" => true, + "action_dispatch.show_detailed_exceptions" => false, + "consider_all_requests_local" => false + ) + end + end + config.before(:each, :delay_jobs) do Delayed::Worker.delay_jobs = true end diff --git a/spec/system/admin/feature_flags_spec.rb b/spec/system/admin/feature_flags_spec.rb index 28636ed2d..68ae8502c 100644 --- a/spec/system/admin/feature_flags_spec.rb +++ b/spec/system/admin/feature_flags_spec.rb @@ -14,7 +14,7 @@ describe "Admin feature flags", :admin do end end - scenario "Disable a participatory process" do + scenario "Disable a participatory process", :show_exceptions do setting = Setting.find_by(key: "process.budgets") budget = create(:budget) @@ -33,8 +33,14 @@ describe "Admin feature flags", :admin do expect(page).not_to have_link "Participatory budgets" end - expect { visit budget_path(budget) }.to raise_exception(FeatureFlags::FeatureDisabled) - expect { visit admin_budgets_path }.to raise_exception(FeatureFlags::FeatureDisabled) + visit budget_path(budget) + + expect(page).to have_content "Internal server error" + + visit admin_budgets_path + + expect(page).to have_current_path admin_budgets_path + expect(page).to have_content "Internal server error" end scenario "Enable a disabled participatory process" do