-
-
Save deathbob/1043678 to your computer and use it in GitHub Desktop.
Guard + Rspec + Spork
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
# A sample Guardfile | |
# More info at https://github.com/guard/guard#readme | |
guard 'rspec', :version => 2, | |
:cli => '--colour --drb --format documentation --fail-fast', | |
:all_after_pass => false, | |
:all_on_start => false, | |
:keep_failed => false, | |
:notify => true do | |
watch(%r{^spec/.+_spec\.rb$}) | |
watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" } | |
watch('spec/spec_helper.rb') { "spec" } | |
# Rails example | |
watch(%r{^spec/.+_spec\.rb$}) | |
watch(%r{^app/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" } | |
watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" } | |
watch(%r{^app/controllers/(.+)_(controller)\.rb$}) { |m| ["spec/routing/#{m[1]}_routing_spec.rb", "spec/#{m[2]}s/#{m[1]}_#{m[2]}_spec.rb", "spec/acceptance/#{m[1]}_spec.rb"] } | |
watch(%r{^spec/support/(.+)\.rb$}) { "spec" } | |
watch('spec/spec_helper.rb') { "spec" } | |
watch('config/routes.rb') { "spec/routing" } | |
watch('app/controllers/application_controller.rb') { "spec/controllers" } | |
# Capybara request specs | |
watch(%r{^app/views/(.+)/.*\.(erb|haml)$}) { |m| "spec/requests/#{m[1]}_spec.rb" } | |
end | |
guard 'spork', :cucumber => false, :rspec_env => { 'RAILS_ENV' => 'test' }, :bundler => false, :notify => true, :wait => 30 do | |
watch('spec/spec_helper.rb') | |
end |
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
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. | |
# Configure Rails Envinronment | |
ENV["RAILS_ENV"] = "test" | |
require File.expand_path("../../../hannah_keeley/config/environment.rb", __FILE__) | |
require 'active_support' | |
require 'rspec/rails' | |
require 'mocha' | |
require 'rspec/rails/mocha' | |
require 'rails/all' | |
require 'growl' | |
require 'shoulda/matchers' | |
ActionMailer::Base.delivery_method = :test | |
ActionMailer::Base.perform_deliveries = true | |
ActionMailer::Base.default_url_options[:host] = "test.com" | |
ActionController::Base.default_url_options[:host] = "test.com" | |
Rails.backtrace_cleaner.remove_silencers! | |
Dir["#{File.dirname(__FILE__)}/fabricators/**/*.rb"].each { |f| require f } | |
Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each { |f| require f } | |
RSpec.configure do |config| | |
config.mock_with :mocha | |
config.include Devise::TestHelpers, :type => :controller | |
config.include Devise::TestHelpers, :type => :view | |
config.include RSpec::Rails::Mocha | |
end | |
end | |
Spork.each_run do | |
# This code will be run each time you run your specs. | |
Dir["#{File.dirname(__FILE__)}/fabricators/**/*.rb"].each { |f| require f } | |
Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each { |f| require f } | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment