mirror of
https://github.com/heartcombo/devise.git
synced 2022-11-09 12:18:31 -05:00
25 lines
585 B
Ruby
25 lines
585 B
Ruby
class ActionController::IntegrationTest
|
|
|
|
def warden
|
|
request.env['warden']
|
|
end
|
|
|
|
def create_user(options={})
|
|
@user ||= begin
|
|
user = User.create!(
|
|
:email => 'test@test.com', :password => '123456', :password_confirmation => '123456'
|
|
)
|
|
user.confirm! unless options[:confirm] == false
|
|
user
|
|
end
|
|
end
|
|
|
|
def sign_in(options={}, &block)
|
|
create_user(options)
|
|
visit 'users/session/new'
|
|
fill_in 'email', :with => 'test@test.com'
|
|
fill_in 'password', :with => '123456'
|
|
yield if block_given?
|
|
click_button 'Sign In'
|
|
end
|
|
end
|