0
0
Fork 0

Fix RSpec/StubbedMock cop (#25552)

Co-authored-by: Claire <claire.github-309c@sitedethib.com>
This commit is contained in:
Matt Jankowski 2023-07-12 04:20:10 -04:00 committed by GitHub
parent 2e1391fdd2
commit 6c5a2233a8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 26 additions and 31 deletions

View file

@ -77,19 +77,17 @@ describe ApplicationHelper do
describe 'open_registrations?' do
it 'returns true when open for registrations' do
without_partial_double_verification do
expect(Setting).to receive(:registrations_mode).and_return('open')
end
allow(Setting).to receive(:[]).with('registrations_mode').and_return('open')
expect(helper.open_registrations?).to be true
expect(Setting).to have_received(:[]).with('registrations_mode')
end
it 'returns false when closed for registrations' do
without_partial_double_verification do
expect(Setting).to receive(:registrations_mode).and_return('none')
end
allow(Setting).to receive(:[]).with('registrations_mode').and_return('none')
expect(helper.open_registrations?).to be false
expect(Setting).to have_received(:[]).with('registrations_mode')
end
end
@ -296,8 +294,9 @@ describe ApplicationHelper do
it 'returns site title on production environment' do
Setting.site_title = 'site title'
expect(Rails.env).to receive(:production?).and_return(true)
allow(Rails.env).to receive(:production?).and_return(true)
expect(helper.title).to eq 'site title'
expect(Rails.env).to have_received(:production?)
end
end
end