Module: Features::SessionHelpers

Defined in:
lib/generators/start/spec_helpers/templates/spec/support/features/session_helpers.rb

Instance Method Summary collapse

Instance Method Details

#sign_inObject



16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/generators/start/spec_helpers/templates/spec/support/features/session_helpers.rb', line 16

def 
  user = User.create!(name: 'John Doe', email: '[email protected]', password: '12345678')

  visit new_user_session_path

  within('.panel-login') do
    fill_in 'user[email]', with: '[email protected]'
    fill_in 'user[password]', with: '12345678'

    click_button 'Entrar'
  end

  user
end

#sign_up_with(name, email, password) ⇒ Object



3
4
5
6
7
8
9
10
11
12
13
14
# File 'lib/generators/start/spec_helpers/templates/spec/support/features/session_helpers.rb', line 3

def (name, email, password)
  visit new_user_registration_path

  fill_in 'user[name]', with: name
  fill_in 'user[email]', with: email
  fill_in 'user[password]', with: password
  fill_in 'user[password_confirmation]', with: password

  click_button 'Cadastrar'

  User.find_by(email: email)
end