thoughtbot--shoulda-matchers/spec/spec_helper.rb

33 lines
983 B
Ruby
Raw Normal View History

ENV['RAILS_ENV'] = 'test'
2010-12-14 23:35:12 +00:00
ENV['RAILS_VERSION'] ||= '3.0.3'
RAILS_GEM_VERSION = ENV['RAILS_VERSION']
rails_root = File.dirname(__FILE__) + '/rails3_root'
ENV['BUNDLE_GEMFILE'] = rails_root + '/Gemfile'
require "#{rails_root}/config/environment"
require 'rspec'
require 'rspec/autorun'
PROJECT_ROOT = File.expand_path(File.join(File.dirname(__FILE__), '..')).freeze
$LOAD_PATH << File.join(PROJECT_ROOT, 'lib')
Dir[File.join(PROJECT_ROOT, 'spec', 'support', '**', '*.rb')].each { |file| require(file) }
2010-12-15 22:34:19 +00:00
require 'shoulda-matchers'
require 'rspec/rails'
# Run the migrations
ActiveRecord::Migration.verbose = false
ActiveRecord::Migrator.migrate("#{Rails.root}/db/migrate")
RSpec.configure do |config|
config.mock_with :mocha
2010-12-15 22:34:19 +00:00
config.include Shoulda::Matchers::ActionController,
:example_group => { :file_path => /action_controller/ }
2010-12-15 22:34:19 +00:00
config.include Shoulda::Matchers::ActionMailer,
:example_group => { :file_path => /action_mailer/ }
end