ruby on rails - How to test devise lockable feature spec -


i using devise lockable lock user account after 10 tries login invalid password. have tested hand, works fine .. see flash message 'your account locked` after 10 number of failed attempts. don't want test flash message, want check @ model level or session level verify user should not logged in, how go this?

specify 'lock user after 10 invalid sign ins'   user.find_by(email: 'email@domain.com').update(failed_attempts: 11, locked_at: datetime.now)   visit '/users/sign_in'   fill_in 'email', with: 'email@domain.com'   fill_in 'password', with: 'avalidpassword!'   click_button 'sign in'   expect(current_user).to be_nil end 

with code above, current_user or session not accessible here in feature spec, should writing controller spec?


Comments

Popular posts from this blog

ubuntu - PHP script to find files of certain extensions in a directory, returns populated array when run in browser, but empty array when run from terminal -

php - How can i create a user dashboard -

javascript - How to detect toggling of the fullscreen-toolbar in jQuery Mobile? -