Created
June 23, 2010 17:53
-
-
Save cmilfont/450280 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#arquivo spec_helper.rb | |
ENV["RAILS_ENV"] ||= 'test' | |
require File.expand_path(File.join(File.dirname(__FILE__),'..','config','environment')) | |
require 'spec/autorun' | |
require 'spec/rails' | |
require 'rake' | |
require 'ruby-debug' unless RUBY_VERSION > '1.9' | |
require 'sunspot/rails/tasks' | |
require 'authlogic/test_case' | |
require 'sunspot/rails/spec_helper' | |
require 'database_cleaner' | |
#observe aqui que eu criei uma pasta support porque guardo algumas confs em arquivos contidos nela | |
Dir["#{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.fixture_path = RAILS_ROOT + '/spec/fixtures/' | |
config.before(:suite) do | |
DatabaseCleaner.strategy = :truncation | |
DatabaseCleaner.clean_with(:truncation) | |
end | |
config.before(:each) do | |
DatabaseCleaner.start | |
end | |
config.after(:each) do | |
DatabaseCleaner.clean | |
end | |
[:model, :helper, :controller].each {|type| | |
config.before(:each, :type => type) do | |
::Sunspot.session = ::Sunspot::Rails::StubSessionProxy.new(::Sunspot.session) | |
end | |
config.after(:each, :type => type) do | |
::Sunspot.session = ::Sunspot.session.original_session | |
end | |
} | |
config.before(:all, :type => :integration) do | |
JojobaSunspot.new.start | |
end | |
config.after(:suite) do | |
JojobaSunspot.new.stop | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment