Skip to content

Instantly share code, notes, and snippets.

@jpemberthy
Created September 2, 2010 14:15
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save jpemberthy/562337 to your computer and use it in GitHub Desktop.
ENV["RAILS_ENV"] ||= 'test'
require File.expand_path("../../config/environment", __FILE__)
require 'rspec/rails'
# Requires supporting files with custom matchers and macros, etc,
# in ./support/ and its subdirectories.
Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each {|f| require f}
RSpec.configure do |config|
config.mock_with :mocha
config.fixture_path = "#{::Rails.root}/spec/fixtures"
config.use_transactional_fixtures = true
end
module AuthlogicTestHelper
def login_as(user)
@user_session = mock('user_session')
@user_session.stubs(:user).returns(user)
@user_session.stubs(:record).returns(user)
@user_session.stubs(:destroy)
UserSession.stubs(:find).returns(@user_session)
end
def user_logout
@user_session = nil
UserSession.stubs(:find).returns(nil)
end
end
include AuthlogicTestHelper
source 'http://rubygems.org'
gem 'rails', '3'
group :test do
gem "rspec-rails", ">= 2.0.0.beta.20"
gem "mocha"
gem "factory_girl_rails"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment