Sha256: 63aa1a8de26870934cc3b8717b7667b47b8d54fddff8846c663a052c1c9957dd

Contents?: true

Size: 589 Bytes

Versions: 7

Compression:

Stored size: 589 Bytes

Contents

module ControllerMacros
  def login_user
    before(:each) do
      @request.env["devise.mapping"] = Devise.mappings[:user]
      user = FactoryBot.create(:user)
      sign_in user
    end
  end
end

RSpec.configure do |config|
  config.include Devise::Test::ControllerHelpers, type: :controller
  config.extend ControllerMacros, type: :controller
  # FIXME: For some reason devise is not loading correctly
  # So we are forced to include this where it is supposed to go
  config.before(:all, type: :controller) do
    ::ApplicationController.include Devise::Controllers::Helpers
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
authz-0.0.5 spec/support/devise.rb
authz-0.0.4 spec/support/devise.rb
authz-0.0.3 spec/support/devise.rb
authz-0.0.2 spec/support/devise.rb
authz-0.0.1 spec/support/devise.rb
authz-0.0.1.alpha5 spec/support/devise.rb
authz-0.0.1.alpha4 spec/support/devise.rb