2015-11-08 09:41:11 +00:00
|
|
|
require "spec_helper"
|
2014-04-04 19:38:44 +00:00
|
|
|
|
2015-11-08 09:41:11 +00:00
|
|
|
feature "Case insensitive login", js: :true do
|
2014-04-04 19:38:44 +00:00
|
|
|
let(:username) { "CaSe_InSeNsItIvE" }
|
|
|
|
let(:password) { "passwordABC123" }
|
|
|
|
let!(:user) { create(:user, username: username, raw_password: password) }
|
|
|
|
|
|
|
|
before do
|
|
|
|
visit root_path
|
|
|
|
end
|
|
|
|
|
2015-11-08 09:41:11 +00:00
|
|
|
feature "when a user with mixed-case username signs in" do
|
|
|
|
scenario "with a matching case allows the user to sign in" do
|
2014-04-04 19:38:44 +00:00
|
|
|
fill_login_form(username)
|
|
|
|
click_button submit(:user, :login)
|
2015-11-08 09:41:11 +00:00
|
|
|
|
|
|
|
expect(page).to have_content(I18n.t("login_successful"))
|
|
|
|
|
2014-04-17 07:55:19 +00:00
|
|
|
within user_status do
|
2014-05-10 01:26:18 +00:00
|
|
|
expect(page).to have_content(account_link)
|
2014-04-17 07:55:19 +00:00
|
|
|
end
|
2014-04-04 19:38:44 +00:00
|
|
|
end
|
|
|
|
|
2015-11-08 09:41:11 +00:00
|
|
|
scenario "with a non-matching case allows the user to sign in" do
|
2014-04-04 19:38:44 +00:00
|
|
|
fill_login_form("CASE_INSENSITIVE")
|
|
|
|
click_button submit(:user, :login)
|
2015-11-08 09:41:11 +00:00
|
|
|
|
|
|
|
expect(page).to have_content(I18n.t("login_successful"))
|
2014-04-17 07:55:19 +00:00
|
|
|
|
|
|
|
within user_status do
|
2014-05-10 01:26:18 +00:00
|
|
|
expect(page).to have_content(account_link)
|
2014-04-17 07:55:19 +00:00
|
|
|
end
|
2014-04-04 19:38:44 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
def fill_login_form(username)
|
|
|
|
fill_in "login_username", with: username
|
|
|
|
fill_in "login_password", with: password
|
|
|
|
end
|
2014-05-10 01:26:18 +00:00
|
|
|
|
|
|
|
def account_link
|
2015-11-08 09:41:11 +00:00
|
|
|
"ACCOUNT"
|
2014-05-10 01:26:18 +00:00
|
|
|
end
|
2014-04-04 19:38:44 +00:00
|
|
|
end
|