Sha256: d4b0c9d86402cacdf371ea57f9f087ad866ac54b03de2ee2a85af9151053bb47
Contents?: true
Size: 817 Bytes
Versions: 9
Compression:
Stored size: 817 Bytes
Contents
module Alchemy module TestSupport # Helpers for integration specs # # This file is included in rspec integration/request tests. # module IntegrationHelpers # Used in Capybara features specs. Stubs the current_alchemy_user # # It mocks an admin user, but you can pass in a user object that would be used as stub. # def authorize_as_admin(user=nil) # Ensure that phantomjs has always the same browser language. if Capybara.current_driver == :poltergeist page.driver.headers = { 'Accept-Language' => 'en' } end if !user user = mock_model('DummyUser', alchemy_roles: %w(admin), language: 'en') end ApplicationController.any_instance.stub(:current_user).and_return(user) end end end end
Version data entries
9 entries across 9 versions & 1 rubygems