Commit 79fb96ed1919d5c8c226b24fed44ec259fe53a85
1 parent
0daa306f
Exists in
master
revert
Showing
3 changed files
with
4 additions
and
24 deletions
Show diff stats
spec/acceptance/acceptance_helper.rb
@@ -22,13 +22,7 @@ end | @@ -22,13 +22,7 @@ end | ||
22 | 22 | ||
23 | def log_in(user) | 23 | def log_in(user) |
24 | visit '/' | 24 | visit '/' |
25 | - | ||
26 | - if Errbit::Config.user_has_username | ||
27 | - fill_in :user_username, with: user.username | ||
28 | - else | ||
29 | - fill_in :user_email, with: user.email | ||
30 | - end | ||
31 | - | 25 | + fill_in :user_email, with: user.email |
32 | fill_in :user_password, with: 'password' | 26 | fill_in :user_password, with: 'password' |
33 | click_on I18n.t('devise.sessions.new.sign_in') | 27 | click_on I18n.t('devise.sessions.new.sign_in') |
34 | end | 28 | end |
spec/controllers/devise_sessions_controller_spec.rb
@@ -10,24 +10,13 @@ describe Devise::SessionsController, type: 'controller' do | @@ -10,24 +10,13 @@ describe Devise::SessionsController, type: 'controller' do | ||
10 | let(:user) { Fabricate(:user) } | 10 | let(:user) { Fabricate(:user) } |
11 | 11 | ||
12 | it 'redirects to app index page if there are no apps for the user' do | 12 | it 'redirects to app index page if there are no apps for the user' do |
13 | - details = { 'email' => user.email, 'password' => user.password } | ||
14 | - if Errbit::Config.user_has_username | ||
15 | - details['username'] = user.username | ||
16 | - end | ||
17 | - | ||
18 | - post :create, user: details | 13 | + post :create, user: { 'email' => user.email, 'password' => user.password } |
19 | expect(response).to redirect_to(root_path) | 14 | expect(response).to redirect_to(root_path) |
20 | end | 15 | end |
21 | 16 | ||
22 | it 'displays a friendly error when credentials are invalid' do | 17 | it 'displays a friendly error when credentials are invalid' do |
23 | - details = { 'email' => 'whatever', 'password' => 'somethinginvalid' } | ||
24 | - msg = I18n.t('devise.failure.user.email_invalid') | ||
25 | - if Errbit::Config.user_has_username | ||
26 | - details['username'] = 'somethinginvalid' | ||
27 | - msg = I18n.t('devise.failure.user.username_invalid') | ||
28 | - end | ||
29 | - post :create, user: details | ||
30 | - expect(request.flash["alert"]).to eq(msg) | 18 | + post :create, user: { 'email' => 'whatever', 'password' => 'somethinginvalid' } |
19 | + expect(request.flash["alert"]).to eq(I18n.t 'devise.failure.user.email_invalid') | ||
31 | end | 20 | end |
32 | end | 21 | end |
33 | end | 22 | end |
spec/fabricators/user_fabricator.rb
1 | Fabricator :user do | 1 | Fabricator :user do |
2 | name 'Clyde Frog' | 2 | name 'Clyde Frog' |
3 | email { sequence(:user_email) { |n| "user.#{n}@example.com" } } | 3 | email { sequence(:user_email) { |n| "user.#{n}@example.com" } } |
4 | - if Errbit::Config.user_has_username | ||
5 | - username { sequence(:username) { |n| "User Name #{n}" } } | ||
6 | - end | ||
7 | password 'password' | 4 | password 'password' |
8 | password_confirmation 'password' | 5 | password_confirmation 'password' |
9 | end | 6 | end |