You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
28 lines
842 B
28 lines
842 B
1 year ago
|
require "rails_helper"
|
||
|
|
||
|
RSpec.describe MaintenanceController do
|
||
|
let(:user) { FactoryBot.create(:user) }
|
||
|
|
||
|
describe "GET #service_unavailable" do
|
||
|
context "when maintenance mode is enabled" do
|
||
|
it "logs the user out" do
|
||
|
allow(FeatureToggle).to receive(:maintenance_mode_enabled?).and_return(true)
|
||
|
sign_in user
|
||
|
expect(controller).to be_user_signed_in
|
||
|
get :service_unavailable
|
||
|
expect(controller).not_to be_user_signed_in
|
||
|
end
|
||
|
end
|
||
|
|
||
|
context "when maintenance mode is disabled" do
|
||
|
it "doesn't log the user out" do
|
||
|
allow(FeatureToggle).to receive(:maintenance_mode_enabled?).and_return(false)
|
||
|
sign_in user
|
||
|
expect(controller).to be_user_signed_in
|
||
|
get :service_unavailable
|
||
|
expect(controller).to be_user_signed_in
|
||
|
end
|
||
|
end
|
||
|
end
|
||
|
end
|