BigW Consortium Gitlab

authentication.rb 694 Bytes
Newer Older
Nihad Abbasov committed
1 2 3 4 5 6
require Rails.root.join('spec', 'support', 'login_helpers')

module SharedAuthentication
  include Spinach::DSL
  include LoginHelpers

7
  step 'I sign in as a user' do
Nihad Abbasov committed
8 9
    login_as :user
  end
10

11
  step 'I sign in as an admin' do
12 13
    login_as :admin
  end
randx committed
14

15 16 17 18 19 20 21 22
  step 'I sign in as "John Doe"' do
    login_with(user_exists("John Doe"))
  end

  step 'I sign in as "Mary Jane"' do
    login_with(user_exists("Mary Jane"))
  end

23
  step 'I should be redirected to sign in page' do
24
    expect(current_path).to eq new_user_session_path
25 26
  end

Ciro Santilli committed
27 28 29 30
  step "I logout" do
    logout
  end

31 32 33 34
  step "I logout directly" do
    logout_direct
  end

randx committed
35
  def current_user
36
    @user || User.reorder(nil).first
randx committed
37
  end
Nihad Abbasov committed
38
end