Show Wordpress login button if it's the only one enabled
This commit is contained in:
committed by
Javi Martín
parent
b1c2a4a9f2
commit
b7b05b55fe
@@ -1,4 +1,4 @@
|
|||||||
<% if feature?(:twitter_login) || feature?(:facebook_login) || feature?(:google_login) %>
|
<% if oauth_logins.any? %>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="small-12 column">
|
<div class="small-12 column">
|
||||||
<div class="margin-bottom">
|
<div class="margin-bottom">
|
||||||
|
|||||||
@@ -100,6 +100,103 @@ describe "Users" do
|
|||||||
end
|
end
|
||||||
|
|
||||||
context "OAuth authentication" do
|
context "OAuth authentication" do
|
||||||
|
context "Form buttons" do
|
||||||
|
before do
|
||||||
|
Setting["feature.facebook_login"] = false
|
||||||
|
Setting["feature.twitter_login"] = false
|
||||||
|
Setting["feature.google_login"] = false
|
||||||
|
Setting["feature.wordpress_login"] = false
|
||||||
|
end
|
||||||
|
|
||||||
|
scenario "No button will appear if all features are disabled" do
|
||||||
|
visit new_user_registration_path
|
||||||
|
|
||||||
|
expect(page).not_to have_link "Twitter"
|
||||||
|
expect(page).not_to have_link "Facebook"
|
||||||
|
expect(page).not_to have_link "Google"
|
||||||
|
expect(page).not_to have_link "Wordpress"
|
||||||
|
|
||||||
|
visit new_user_session_path
|
||||||
|
|
||||||
|
expect(page).not_to have_link "Twitter"
|
||||||
|
expect(page).not_to have_link "Facebook"
|
||||||
|
expect(page).not_to have_link "Google"
|
||||||
|
expect(page).not_to have_link "Wordpress"
|
||||||
|
end
|
||||||
|
|
||||||
|
scenario "Twitter login button will appear if feature is enabled" do
|
||||||
|
Setting["feature.twitter_login"] = true
|
||||||
|
|
||||||
|
visit new_user_registration_path
|
||||||
|
|
||||||
|
expect(page).to have_link "Twitter"
|
||||||
|
expect(page).not_to have_link "Facebook"
|
||||||
|
expect(page).not_to have_link "Google"
|
||||||
|
expect(page).not_to have_link "Wordpress"
|
||||||
|
|
||||||
|
visit new_user_session_path
|
||||||
|
|
||||||
|
expect(page).to have_link "Twitter"
|
||||||
|
expect(page).not_to have_link "Facebook"
|
||||||
|
expect(page).not_to have_link "Google"
|
||||||
|
expect(page).not_to have_link "Wordpress"
|
||||||
|
end
|
||||||
|
|
||||||
|
scenario "Facebook login button will appear if feature is enabled" do
|
||||||
|
Setting["feature.facebook_login"] = true
|
||||||
|
|
||||||
|
visit new_user_registration_path
|
||||||
|
|
||||||
|
expect(page).not_to have_link "Twitter"
|
||||||
|
expect(page).to have_link "Facebook"
|
||||||
|
expect(page).not_to have_link "Google"
|
||||||
|
expect(page).not_to have_link "Wordpress"
|
||||||
|
|
||||||
|
visit new_user_session_path
|
||||||
|
|
||||||
|
expect(page).not_to have_link "Twitter"
|
||||||
|
expect(page).to have_link "Facebook"
|
||||||
|
expect(page).not_to have_link "Google"
|
||||||
|
expect(page).not_to have_link "Wordpress"
|
||||||
|
end
|
||||||
|
|
||||||
|
scenario "Google login button will appear if feature is enabled" do
|
||||||
|
Setting["feature.google_login"] = true
|
||||||
|
|
||||||
|
visit new_user_registration_path
|
||||||
|
|
||||||
|
expect(page).not_to have_link "Twitter"
|
||||||
|
expect(page).not_to have_link "Facebook"
|
||||||
|
expect(page).to have_link "Google"
|
||||||
|
expect(page).not_to have_link "Wordpress"
|
||||||
|
|
||||||
|
visit new_user_session_path
|
||||||
|
|
||||||
|
expect(page).not_to have_link "Twitter"
|
||||||
|
expect(page).not_to have_link "Facebook"
|
||||||
|
expect(page).to have_link "Google"
|
||||||
|
expect(page).not_to have_link "Wordpress"
|
||||||
|
end
|
||||||
|
|
||||||
|
scenario "Wordpress login button will appear if feature is enabled" do
|
||||||
|
Setting["feature.wordpress_login"] = true
|
||||||
|
|
||||||
|
visit new_user_registration_path
|
||||||
|
|
||||||
|
expect(page).not_to have_link "Twitter"
|
||||||
|
expect(page).not_to have_link "Facebook"
|
||||||
|
expect(page).not_to have_link "Google"
|
||||||
|
expect(page).to have_link "Wordpress"
|
||||||
|
|
||||||
|
visit new_user_session_path
|
||||||
|
|
||||||
|
expect(page).not_to have_link "Twitter"
|
||||||
|
expect(page).not_to have_link "Facebook"
|
||||||
|
expect(page).not_to have_link "Google"
|
||||||
|
expect(page).to have_link "Wordpress"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
context "Twitter" do
|
context "Twitter" do
|
||||||
let(:twitter_hash) { { provider: "twitter", uid: "12345", info: { name: "manuela" }} }
|
let(:twitter_hash) { { provider: "twitter", uid: "12345", info: { name: "manuela" }} }
|
||||||
let(:twitter_hash_with_email) { { provider: "twitter", uid: "12345", info: { name: "manuela", email: "manuelacarmena@example.com" }} }
|
let(:twitter_hash_with_email) { { provider: "twitter", uid: "12345", info: { name: "manuela", email: "manuelacarmena@example.com" }} }
|
||||||
|
|||||||
Reference in New Issue
Block a user