Sha256: 5173d3e90faaa78df59e6077c27da5d9045680a60aa001b13e76a772eede4b74

Contents?: true

Size: 982 Bytes

Versions: 4

Compression:

Stored size: 982 Bytes

Contents

# frozen_string_literal: true

# Copyright (c) 2008-2013 Michael Dvorkin and contributors.
#
# Fat Free CRM is freely distributable under the terms of MIT license.
# See MIT-LICENSE file or http://www.opensource.org/licenses/mit-license.php
#------------------------------------------------------------------------------

module FeatureHelpers
  # Put helper methods you need to be available in all acceptance specs here.

  def do_login(options = {})
    @user = create(:user, options)
    @user.confirm
    @user.update_attribute(:suspended_at, nil)
    login_as(@user)
  end

  def login_as_user(user)
    user.confirm
    user.update_attribute(:suspended_at, nil)
    visit '/users/sign_in'
    fill_in "user[email]", with: user.username
    fill_in "user[password]", with: user.password
    click_button "Login"
  end

  # if we're already logged in, don't bother doing it again
  def do_login_if_not_already(options = {})
    do_login(options) unless @user.present?
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
fat_free_crm-0.20.1 spec/support/feature_helpers.rb
fat_free_crm-0.20.0 spec/support/feature_helpers.rb
fat_free_crm-0.19.2 spec/support/feature_helpers.rb
fat_free_crm-0.19.0 spec/support/feature_helpers.rb