Skip to content

Instantly share code, notes, and snippets.

@netinlet
Created January 27, 2011 18:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save netinlet/0d3ea01ffe4a15f4b2b3 to your computer and use it in GitHub Desktop.
Save netinlet/0d3ea01ffe4a15f4b2b3 to your computer and use it in GitHub Desktop.
Spec Helper
#
# == Notes
#
# For more information take a look at Spec::Runner::Configuration and Spec::Runner
require 'rubygems'
ENV["RAILS_ENV"] ||= 'test'
require File.expand_path(File.join(File.dirname(__FILE__),'..','config','environment'))
require 'spec/autorun'
require 'spec/rails'
# Requires supporting files with custom matchers and macros, etc,
# in ./support/ and its subdirectories.
Dir[File.expand_path(File.join(File.dirname(__FILE__),'support','**','*.rb'))].each {|f| require f}
Spec::Runner.configure do |config|
config.use_transactional_fixtures = true
config.use_instantiated_fixtures = false
config.before(:each) do
Rails.logger.warn "ZipsTerritory.count == #{ZipsTerritory.count}"
end
# == Fixtures
#
# You can declare fixtures for each example_group like this:
# describe "...." do
# fixtures :table_a, :table_b
#
# Alternatively, if you prefer to declare them only once, you can
# do so right here. Just uncomment the next line and replace the fixture
# names with your fixtures.
#
config.global_fixtures = :products
config.fixture_path = RAILS_ROOT + '/spec/fixtures/'
# == Factories
#
# FactoryGirl...
require File.dirname(__FILE__) + '/factories'
# MileMeter Fixture Factory (pre-FactoryGirl)
require 'test/fixture_factory'
# == Helpers
#
# Necessary for running individual tests which use login_as()
include AuthenticatedTestHelper
def mock_time_zone(t = Time.zone.now)
@time_now = t
@time_zone = Time.zone
@time_zone.stub!(:now).and_return(@time_now)
Time.stub!(:zone).and_return(@time_zone)
end
end
@dchelimsky
Copy link

Line 48 includes AuthenticatedTestHelper in the top level object. Change that to:

config.include AuthenticatedTestHelper

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment