Use _ instead of .
This commit is contained in:
parent
445070f6ec
commit
54cd2cc0e8
|
@ -7,7 +7,7 @@ class RegistrationsController < ApplicationController
|
|||
self.resource = resource_class.new(params[resource_name])
|
||||
|
||||
if resource.save
|
||||
flash[:"#{resource_name}.signed_up"] = true
|
||||
flash[:"#{resource_name}_signed_up"] = true
|
||||
set_flash_message :notice, :signed_up
|
||||
sign_in_and_redirect(resource_name, resource)
|
||||
else
|
||||
|
|
|
@ -8,7 +8,7 @@ class SessionsController < ApplicationController
|
|||
def new
|
||||
Devise::FLASH_MESSAGES.each do |message|
|
||||
set_now_flash_message :alert, message if params.try(:[], message) == "true"
|
||||
end unless flash[:"#{resource_name}.signed_up"]
|
||||
end unless resource_just_signed_up?
|
||||
super
|
||||
end
|
||||
|
||||
|
@ -30,4 +30,9 @@ class SessionsController < ApplicationController
|
|||
sign_out_and_redirect(resource_name)
|
||||
end
|
||||
|
||||
protected
|
||||
|
||||
def resource_just_signed_up?
|
||||
flash[:"#{resource_name}_signed_up"]
|
||||
end
|
||||
end
|
||||
|
|
|
@ -31,15 +31,15 @@ class RegistrationTest < ActionController::IntegrationTest
|
|||
fill_in 'password confirmation', :with => 'new_user123'
|
||||
click_button 'Sign up'
|
||||
|
||||
assert_equal true, @controller.send(:flash)[:"user.signed_up"]
|
||||
assert_equal true, @controller.send(:flash)[:"user_signed_up"]
|
||||
assert_equal "You have signed up successfully.", @controller.send(:flash)[:notice]
|
||||
|
||||
# For some reason flash is not being set correctly, so instead of getting the
|
||||
# "signed_up" message we get the unconfirmed one. Seems to be an issue with
|
||||
# the internal redirect by the hook and the tests.
|
||||
# follow_redirect!
|
||||
# assert_contain 'You have signed up successfully.'
|
||||
# assert_not_contain 'confirm your account'
|
||||
# follow_redirect!
|
||||
# assert_contain 'You have signed up successfully.'
|
||||
# assert_not_contain 'confirm your account'
|
||||
|
||||
assert_not warden.authenticated?(:user)
|
||||
|
||||
|
|
Loading…
Reference in New Issue