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 | 22 | |
| 23 | 23 | def log_in(user) |
| 24 | 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 | 26 | fill_in :user_password, with: 'password' |
| 33 | 27 | click_on I18n.t('devise.sessions.new.sign_in') |
| 34 | 28 | end | ... | ... |
spec/controllers/devise_sessions_controller_spec.rb
| ... | ... | @@ -10,24 +10,13 @@ describe Devise::SessionsController, type: 'controller' do |
| 10 | 10 | let(:user) { Fabricate(:user) } |
| 11 | 11 | |
| 12 | 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 | 14 | expect(response).to redirect_to(root_path) |
| 20 | 15 | end |
| 21 | 16 | |
| 22 | 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 | 20 | end |
| 32 | 21 | end |
| 33 | 22 | end | ... | ... |
spec/fabricators/user_fabricator.rb
| 1 | 1 | Fabricator :user do |
| 2 | 2 | name 'Clyde Frog' |
| 3 | 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 | 4 | password 'password' |
| 8 | 5 | password_confirmation 'password' |
| 9 | 6 | end | ... | ... |