Sha256: 5049a36a9a2176ec3dfad2d5666de0aa80ddc72d36f86c16df7642512feb032d

Contents?: true

Size: 857 Bytes

Versions: 2

Compression:

Stored size: 857 Bytes

Contents

ENV['RAILS_ENV'] ||= 'test'
require_relative '../config/environment'
require 'rails/test_help'

module ActiveSupport
  class TestCase
    # Run tests in parallel with specified workers
    parallelize(workers: :number_of_processors)

    # Setup all fixtures in test/fixtures/*.yml for all tests in alphabetical order.
    fixtures :all

    # Add more helper methods to be used by all tests here...
    def acting_as(user)
      post login_path, params: { email: user.email, password: 'password' }

      self
    end

    def current_auth
      Auth.new('web', session)
    end

    def assert_authenticated
      assert is_authenticated, 'The user is not authenticated'
    end

    def assert_guest
      assert_not is_authenticated, 'The user is authenticated'
    end

    private

    def is_authenticated
      current_auth.check?
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
kaze-0.7.0 stubs/default/test/test_helper.rb
kaze-0.6.0 stubs/default/test/test_helper.rb