test/integration/lockable_test.rb in devise-1.0.11 vs test/integration/lockable_test.rb in devise-1.1.pre

- old
+ new

@@ -34,20 +34,10 @@ assert_template 'unlocks/new' assert_contain 'not locked' assert_equal 0, ActionMailer::Base.deliveries.size end - test 'unlocked pages should not be available if email strategy is disabled' do - visit new_user_unlock_path - assert_response :success - - swap Devise, :unlock_strategy => :time do - visit new_user_unlock_path - assert_response :not_found - end - end - test 'user with invalid unlock token should not be able to unlock an account' do visit_user_unlock_with_token('invalid_token') assert_response :success assert_template 'unlocks/new' @@ -55,40 +45,31 @@ assert_contain /Unlock token(.*)invalid/ end test "locked user should be able to unlock account" do user = create_user(:locked => true) - assert user.access_locked? + assert user.locked? visit_user_unlock_with_token(user.unlock_token) assert_template 'home/index' assert_contain 'Your account was successfully unlocked.' - assert_not user.reload.access_locked? + assert_not user.reload.locked? end test "sign in user automatically after unlocking it's account" do user = create_user(:locked => true) visit_user_unlock_with_token(user.unlock_token) + assert warden.authenticated?(:user) end test "user should not be able to sign in when locked" do user = sign_in_as_user(:locked => true) assert_template 'sessions/new' assert_contain 'Your account is locked.' assert_not warden.authenticated?(:user) - end - - test "user should not send a new e-mail if already locked" do - user = create_user(:locked => true) - user.update_attribute(:failed_attempts, User.maximum_attempts + 1) - ActionMailer::Base.deliveries.clear - - sign_in_as_user(:password => "invalid") - assert_contain 'Invalid email or password.' - assert ActionMailer::Base.deliveries.empty? end test 'error message is configurable by resource name' do store_translations :en, :devise => { :sessions => { :admin => { :locked => "You are locked!" } }