Sha256: ae02bcdf66ab7b43b4f9ede70462187c89f6348f61bb5828bf6e641302ebeb5f

Contents?: true

Size: 730 Bytes

Versions: 16

Compression:

Stored size: 730 Bytes

Contents

# frozen_string_literal: true

require 'devise'

RSpec.configure do |config|
  config.include Warden::Test::Helpers

  config.after(:each) do
    Warden.test_reset!
  end
end

FactoryBot.define do
  factory :user, class: ::EacUsersSupport::User do
    email 'admin@example.com'
    password 'mysecret'
  end
end

RSpec.shared_context 'when user is admin', shared_context: :metadata do
  let(:user) { ::FactoryBot.create(:user) }

  before do
    visit '/users/sign_in'
    fill_in 'E-mail', with: user.email
    fill_in 'Password', with: user.password
    click_on 'Log in'
  end

  it 'user should be logged' do
    expect(page).to have_content user.email
    expect(::EacUsersSupport::User.current_user).not_to be_nil
  end
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
eac_rails_base0-0.18.0 lib/eac_rails_base0/spec_helper/eac_users_support.rb
eac_rails_base0-0.17.0 lib/eac_rails_base0/spec_helper/eac_users_support.rb
eac_rails_base0-0.16.0 lib/eac_rails_base0/spec_helper/eac_users_support.rb
eac_rails_base0-0.15.2 lib/eac_rails_base0/spec_helper/eac_users_support.rb
eac_rails_base0-0.15.1 lib/eac_rails_base0/spec_helper/eac_users_support.rb
eac_rails_base0-0.15.0 lib/eac_rails_base0/spec_helper/eac_users_support.rb
eac_rails_base0-0.14.0 lib/eac_rails_base0/spec_helper/eac_users_support.rb
eac_rails_base0-0.13.2 lib/eac_rails_base0/spec_helper/eac_users_support.rb
eac_rails_base0-0.13.1 lib/eac_rails_base0/spec_helper/eac_users_support.rb
eac_rails_base0-0.13.0 lib/eac_rails_base0/spec_helper/eac_users_support.rb
eac_rails_base0-0.12.0 lib/eac_rails_base0/spec_helper/eac_users_support.rb
eac_rails_base0-0.11.0 lib/eac_rails_base0/spec_helper/eac_users_support.rb
eac_rails_base0-0.9.0 lib/eac_rails_base0/spec_helper/eac_users_support.rb
eac_rails_base0-0.8.0 lib/eac_rails_base0/spec_helper/eac_users_support.rb
eac_rails_base0-0.7.0 lib/eac_rails_base0/spec_helper/eac_users_support.rb
eac_rails_base0-0.6.0 lib/eac_rails_base0/spec_helper/eac_users_support.rb