Sha256: 6b7482380ad94e9c8855b4c54d782eb81564a8277cee5f84ae40d06257b61f47

Contents?: true

Size: 828 Bytes

Versions: 5

Compression:

Stored size: 828 Bytes

Contents

# frozen_string_literal: true

module ControllerHelpers
  def sign_in
    @account = Spina::Account.create name: 'My Website', preferences: { theme: 'default' }
    @user = Spina::User.create name: 'admin', email: 'admin@example.com', password: 'password', admin: true
    request.session[:user_id] = @user.id
  end
end

module FeatureHelpers
  def sign_in
    @account = Spina::Account.create name: 'My Website', preferences: { theme: 'default' }
    @user = Spina::User.create name: 'admin', email: 'admin@example.com', password: 'password', admin: true
    visit '/admin/login'
    fill_in :email, with: @user.email
    fill_in :password, with: 'password'
    click_button 'Login'
  end
end

RSpec.configure do |config|
  config.include ControllerHelpers, type: :controller
  config.include FeatureHelpers, type: :system
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
spina-admin-conferences-blog-0.1.4 spec/support/controller_helpers.rb
spina-admin-conferences-blog-0.1.3 spec/support/controller_helpers.rb
spina-admin-conferences-blog-0.1.2 spec/support/controller_helpers.rb
spina-admin-conferences-blog-0.1.1 spec/support/controller_helpers.rb
spina-admin-conferences-blog-0.1.0 spec/support/controller_helpers.rb