Sha256: bb6d735786bf57049643663ec5448ddf5339f499cb71cc3b6073594544d7b449

Contents?: true

Size: 867 Bytes

Versions: 7

Compression:

Stored size: 867 Bytes

Contents

# spec/support/features/session_helpers.rb
module Features
  module SessionHelpers
    def sign_up_with(email, password)
      Capybara.exact = true
      visit new_user_registration_path
      fill_in 'Email', with: email
      fill_in 'Password', with: password
      fill_in 'Password confirmation', with: password
      click_button 'Sign up'
    end

    def sign_in(who = :user)
      if who.instance_of?(User)
        user = who
      else
        user = FactoryGirl.find_or_create(who)
        if user.password.nil?   # get the password from the factory if user was retrieved from database
          tmpl = FactoryGirl.build(who)
          user.password = tmpl.password
        end
      end
      visit new_user_session_path
      fill_in 'Email', with: user.email
      fill_in 'Password', with: user.password
      click_button 'Sign in'
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
sufia-4.0.0.beta2 spec/support/features/session_helpers.rb
sufia-4.0.0.beta1 spec/support/features/session_helpers.rb
sufia-3.7.2 spec/support/features/session_helpers.rb
sufia-3.7.1 spec/support/features/session_helpers.rb
sufia-3.7.0 spec/support/features/session_helpers.rb
sufia-3.6.1 spec/support/features/session_helpers.rb
sufia-3.6.0 spec/support/features/session_helpers.rb