Remove a few Ruby syntax warnings from the test suite.
This commit is contained in:
parent
8ac32f14b1
commit
13285d7ef3
|
@ -6,7 +6,7 @@ class SessionsControllerTest < Devise::ControllerTestCase
|
|||
|
||||
test "#create doesn't raise unpermitted params when sign in fails" do
|
||||
begin
|
||||
subscriber = ActiveSupport::Notifications.subscribe /unpermitted_parameters/ do |name, start, finish, id, payload|
|
||||
subscriber = ActiveSupport::Notifications.subscribe %r{unpermitted_parameters} do |name, start, finish, id, payload|
|
||||
flunk "Unpermitted params: #{payload}"
|
||||
end
|
||||
request.env["devise.mapping"] = Devise.mappings[:user]
|
||||
|
|
|
@ -74,7 +74,7 @@ if DEVISE_ORM == :active_record
|
|||
|
||||
assert_file "app/models/rails_engine/monster.rb", /devise/
|
||||
assert_file "app/models/rails_engine/monster.rb" do |content|
|
||||
assert_no_match /attr_accessible :email/, content
|
||||
assert_no_match %r{attr_accessible :email}, content
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -365,7 +365,7 @@ class AuthenticationWithScopedViewsTest < Devise::IntegrationTest
|
|||
assert_raise Webrat::NotFoundError do
|
||||
sign_in_as_user
|
||||
end
|
||||
assert_match /Special user view/, response.body
|
||||
assert_match %r{Special user view}, response.body
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -376,7 +376,7 @@ class AuthenticationWithScopedViewsTest < Devise::IntegrationTest
|
|||
sign_in_as_user
|
||||
end
|
||||
|
||||
assert_match /Special user view/, response.body
|
||||
assert_match %r{Special user view}, response.body
|
||||
assert !Devise::PasswordsController.scoped_views?
|
||||
ensure
|
||||
Devise::SessionsController.send :remove_instance_variable, :@scoped_views
|
||||
|
@ -449,7 +449,7 @@ class AuthenticationOthersTest < Devise::IntegrationTest
|
|||
test 'sign in stub in xml format' do
|
||||
get new_user_session_path(format: 'xml')
|
||||
assert_match '<?xml version="1.0" encoding="UTF-8"?>', response.body
|
||||
assert_match /<user>.*<\/user>/m, response.body
|
||||
assert_match %r{<user>.*</user>}m, response.body
|
||||
assert_match '<email></email>', response.body
|
||||
assert_match '<password nil="true"', response.body
|
||||
end
|
||||
|
|
|
@ -35,7 +35,7 @@ class ConfirmationTest < Devise::IntegrationTest
|
|||
test 'user with invalid confirmation token should not be able to confirm an account' do
|
||||
visit_user_confirmation_with_token('invalid_confirmation')
|
||||
assert_have_selector '#error_explanation'
|
||||
assert_contain /Confirmation token(.*)invalid/
|
||||
assert_contain %r{Confirmation token(.*)invalid}
|
||||
end
|
||||
|
||||
test 'user with valid confirmation token should not be able to confirm an account after the token has expired' do
|
||||
|
@ -45,7 +45,7 @@ class ConfirmationTest < Devise::IntegrationTest
|
|||
visit_user_confirmation_with_token(user.raw_confirmation_token)
|
||||
|
||||
assert_have_selector '#error_explanation'
|
||||
assert_contain /needs to be confirmed within 3 days/
|
||||
assert_contain %r{needs to be confirmed within 3 days}
|
||||
assert_not user.reload.confirmed?
|
||||
assert_current_url "/users/confirmation?confirmation_token=#{user.raw_confirmation_token}"
|
||||
end
|
||||
|
|
|
@ -75,7 +75,7 @@ class LockTest < Devise::IntegrationTest
|
|||
assert_response :success
|
||||
assert_current_url '/users/unlock?unlock_token=invalid_token'
|
||||
assert_have_selector '#error_explanation'
|
||||
assert_contain /Unlock token(.*)invalid/
|
||||
assert_contain %r{Unlock token(.*)invalid}
|
||||
end
|
||||
|
||||
test "locked user should be able to unlock account" do
|
||||
|
|
|
@ -146,7 +146,7 @@ class PasswordTest < Devise::IntegrationTest
|
|||
assert_response :success
|
||||
assert_current_url '/users/password'
|
||||
assert_have_selector '#error_explanation'
|
||||
assert_contain /Reset password token(.*)invalid/
|
||||
assert_contain %r{Reset password token(.*)invalid}
|
||||
assert_not user.reload.valid_password?('987654321')
|
||||
end
|
||||
|
||||
|
@ -212,7 +212,7 @@ class PasswordTest < Devise::IntegrationTest
|
|||
test 'does not sign in user automatically after changing its password if it\'s locked and unlock strategy is :none or :time' do
|
||||
[:none, :time].each do |strategy|
|
||||
swap Devise, unlock_strategy: strategy do
|
||||
user = create_user(locked: true)
|
||||
create_user(locked: true)
|
||||
request_forgot_password
|
||||
reset_password
|
||||
|
||||
|
|
|
@ -121,7 +121,7 @@ class RememberMeTest < Devise::IntegrationTest
|
|||
|
||||
test 'extends remember period when extend remember period config is true' do
|
||||
swap Devise, extend_remember_period: true, remember_for: 1.year do
|
||||
user = create_user_and_remember
|
||||
create_user_and_remember
|
||||
old_remember_token = nil
|
||||
|
||||
travel_to 1.day.ago do
|
||||
|
@ -138,7 +138,7 @@ class RememberMeTest < Devise::IntegrationTest
|
|||
|
||||
test 'does not extend remember period when extend period config is false' do
|
||||
swap Devise, extend_remember_period: false, remember_for: 1.year do
|
||||
user = create_user_and_remember
|
||||
create_user_and_remember
|
||||
old_remember_token = nil
|
||||
|
||||
travel_to 1.day.ago do
|
||||
|
|
|
@ -5,8 +5,7 @@ class ApplicationController < ActionController::Base
|
|||
protect_from_forgery
|
||||
before_action :current_user, unless: :devise_controller?
|
||||
before_action :authenticate_user!, if: :devise_controller?
|
||||
respond_to *Mime::SET.map(&:to_sym)
|
||||
respond_to(*Mime::SET.map(&:to_sym))
|
||||
|
||||
devise_group :commenter, contains: [:user, :admin]
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in New Issue