Created
August 29, 2011 17:17
-
-
Save chip/1178866 to your computer and use it in GitHub Desktop.
Spork config for spec_helper.rb
This file contains hidden or 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
| require 'rubygems' | |
| require 'spork' | |
| Spork.prefork do | |
| ENV["RAILS_ENV"] ||= 'test' | |
| require File.expand_path("../../config/environment", __FILE__) | |
| require 'rspec/rails' | |
| # Requires supporting ruby files with custom matchers and macros, etc, | |
| # in spec/support/ and its subdirectories. | |
| Dir[Rails.root.join("spec/support/**/*.rb")].each {|f| require File.expand_path(f) } | |
| if Spork.using_spork? | |
| ActiveSupport::Dependencies.clear | |
| ActiveRecord::Base.instantiate_observers | |
| end | |
| RSpec.configure do |config| | |
| config.before(:all) do | |
| DeferredGarbageCollection.start | |
| end | |
| config.after(:all) do | |
| DeferredGarbageCollection.reconsider | |
| end | |
| config.include Capybara | |
| Capybara.default_wait_time = 5 | |
| Capybara.app_host = "http://localhost:3000" | |
| # :zombie, :envjs | |
| Capybara.javascript_driver = :akephalos | |
| Capybara.default_driver = :rack_test | |
| Capybara.register_driver :selenium do |app| | |
| Capybara::Selenium::Driver.new(app, :browser => :chrome) | |
| end | |
| config.mock_with :rspec | |
| # Remove this line if you're not using ActiveRecord or ActiveRecord fixtures | |
| config.fixture_path = "#{::Rails.root}/spec/fixtures" | |
| # If you're not using ActiveRecord, or you'd prefer not to run each of your | |
| # examples within a transaction, remove the following line or assign false | |
| # instead of true. | |
| config.use_transactional_fixtures = true | |
| end | |
| #module Kernel | |
| # def require_with_trace(*args) | |
| # start = Time.now.to_f | |
| # @indent ||= 0 | |
| # @indent += 2 | |
| # require_without_trace(*args) | |
| # @indent -= 2 | |
| # Kernel::puts "#{' '*@indent}#{((Time.now.to_f - start)*1000).to_i} #{args[0]}" | |
| # end | |
| # alias_method_chain :require, :trace | |
| #end | |
| # Pre-loading for performance: | |
| require 'rspec/mocks' | |
| require 'rspec/core/expecting/with_rspec' | |
| require 'rspec/core/formatters/documentation_formatter' | |
| require 'rspec/core/formatters/base_text_formatter' | |
| require 'rspec/core/mocking/with_rspec' | |
| require 'rspec/core/expecting/with_rspec' | |
| require 'rspec/expectations' | |
| require 'rspec/matchers' | |
| require 'active_support/secure_random' | |
| end | |
| Spork.each_run do | |
| FactoryGirl.factories.clear | |
| Dir[Rails.root.join('spec/factories/**/*.rb')].each{|f| load f} | |
| RailsInvoice::Application.reload_routes! | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment