Add tests for openid signup with every provider
The spec for omniauth doesn't test signup for every provider, and it doesn't test if it has tests for all available providers Also, we no longer use secrets * Add model test to check if the omniauth providers have changed * Test signup using every provider * Replace secretswith environment variables
This commit is contained in:
parent
9341edd9cb
commit
95b88be061
3 changed files with 107 additions and 4 deletions
|
|
@ -118,9 +118,35 @@ feature Openid do
|
|||
end
|
||||
end
|
||||
|
||||
shared_examples 'sign up with openid' do |provider|
|
||||
scenario "has option to sign in with #{provider}" do
|
||||
visit '/accounts/sign_up'
|
||||
expect(page.has_content?('or sign in using')).to eq true
|
||||
expect(page.has_link?("omniauth-#{provider}")).to eq true
|
||||
end
|
||||
|
||||
scenario "sign up with #{provider}" do
|
||||
expected_count_openid = Openid.count + 1
|
||||
expected_count_user = User.count + 1
|
||||
visit '/accounts/sign_up'
|
||||
|
||||
mock_auth_accounts
|
||||
within('#openidlinks') do
|
||||
click_link "omniauth-#{provider}"
|
||||
end
|
||||
expect(flash).to eq("user-#{provider}@example.com signed in successfully with #{provider}")
|
||||
expect(Openid.count).to eq(expected_count_openid)
|
||||
expect(User.count).to eq(expected_count_user)
|
||||
end
|
||||
end
|
||||
|
||||
describe 'omniauth' do
|
||||
if User.omniauth_providers.present?
|
||||
it_behaves_like 'sign in with openid'
|
||||
|
||||
User.omniauth_providers.each do |provider|
|
||||
it_behaves_like 'sign up with openid', provider
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue