Commit 038dbb68 authored by Andrei Gliga's avatar Andrei Gliga

DRYing enabled_button_based_providers tests

parent 3922e7ee
...@@ -19,8 +19,11 @@ describe AuthHelper do ...@@ -19,8 +19,11 @@ describe AuthHelper do
end end
describe 'enabled_button_based_providers' do describe 'enabled_button_based_providers' do
it 'returns all the enabled providers from settings' do before do
allow(helper).to receive(:auth_providers) { [:twitter, :github] } allow(helper).to receive(:auth_providers) { [:twitter, :github] }
end
it 'returns all the enabled providers from settings' do
expect(helper.enabled_button_based_providers).to include(*['twitter', 'github']) expect(helper.enabled_button_based_providers).to include(*['twitter', 'github'])
end end
...@@ -29,15 +32,11 @@ describe AuthHelper do ...@@ -29,15 +32,11 @@ describe AuthHelper do
disabled_oauth_sign_in_sources: ['github'] disabled_oauth_sign_in_sources: ['github']
) )
allow(helper).to receive(:auth_providers) { [:twitter, :github] }
expect(helper.enabled_button_based_providers).to include('twitter') expect(helper.enabled_button_based_providers).to include('twitter')
expect(helper.enabled_button_based_providers).to_not include('github') expect(helper.enabled_button_based_providers).to_not include('github')
end end
it 'returns true for button_based_providers_enabled? because there providers' do it 'returns true for button_based_providers_enabled? because there providers' do
allow(helper).to receive(:auth_providers) { [:twitter, :github] }
expect(helper.button_based_providers_enabled?).to be true expect(helper.button_based_providers_enabled?).to be true
end end
...@@ -46,8 +45,6 @@ describe AuthHelper do ...@@ -46,8 +45,6 @@ describe AuthHelper do
disabled_oauth_sign_in_sources: ['github', 'twitter'] disabled_oauth_sign_in_sources: ['github', 'twitter']
) )
allow(helper).to receive(:auth_providers) { [:twitter, :github] }
expect(helper.button_based_providers_enabled?).to be false expect(helper.button_based_providers_enabled?).to be false
end end
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment