Created
September 1, 2010 09:35
-
-
Save shripadk/560466 to your computer and use it in GitHub Desktop.
Rspec Autotest Spork
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 File.expand_path('../boot', __FILE__) | |
require 'rails/all' | |
# If you have a Gemfile, require the gems listed there, including any gems | |
# you've limited to :test, :development, or :production. | |
Bundler.require(:default, Rails.env) if defined?(Bundler) | |
module SampleApp | |
class Application < Rails::Application | |
. | |
. | |
. | |
### Part of a Spork hack. See http://bit.ly/arY19y | |
if Rails.env.test? | |
initializer :after => :initialize_dependency_mechanism do | |
# Work around initializer in railties/lib/rails/application/bootstrap.rb | |
ActiveSupport::Dependencies.mechanism = :load | |
end | |
end | |
end | |
end |
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 | |
# Loading more in this block will cause your tests to run faster. However, | |
# if you change any configuration or code from libraries loaded here, you'll | |
# need to restart spork for it take effect. | |
# This file is copied to ~/spec when you run 'ruby script/generate rspec' | |
# from the project root directory. | |
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| | |
# == Mock Framework | |
# | |
# If you prefer to use mocha, flexmock or RR, uncomment the appropriate line: | |
# | |
# config.mock_with :mocha | |
# config.mock_with :flexmock | |
# config.mock_with :rr | |
config.mock_with :rspec | |
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, comment the following line or assign false | |
# instead of true. | |
config.use_transactional_fixtures = true | |
ActiveSupport::Dependencies.clear | |
end | |
end | |
Spork.each_run do | |
# This code will be run each time you run your specs. | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment