First Commit
This commit is contained in:
commit
b5b83e939a
213 changed files with 8688 additions and 0 deletions
16
spec/support/controller_helpers.rb
Normal file
16
spec/support/controller_helpers.rb
Normal file
|
@ -0,0 +1,16 @@
|
|||
module ControllerHelpers
|
||||
def sign_in(user = double('test@localhost.com'))
|
||||
if user.nil?
|
||||
allow(request.env['warden']).to receive(:authenticate!).and_throw(:warden, {:scope => :user})
|
||||
allow(controller).to receive(:current_user).and_return(nil)
|
||||
else
|
||||
allow(request.env['warden']).to receive(:authenticate!).and_return(user)
|
||||
allow(controller).to receive(:current_user).and_return({:email => 'test@localhost.com'})
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
RSpec.configure do |config|
|
||||
config.include Devise::TestHelpers, :type => :controller
|
||||
config.include ControllerHelpers, :type => :controller
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue