Skip to content

Instantly share code, notes, and snippets.

@jamesmoriarty
Created May 9, 2012 09:28
Show Gist options
  • Select an option

  • Save jamesmoriarty/2643282 to your computer and use it in GitHub Desktop.

Select an option

Save jamesmoriarty/2643282 to your computer and use it in GitHub Desktop.
group :development, :test do
gem 'ruby-debug19', :require => 'ruby-debug'
gem 'rspec-rails', '2.8.0'
gem 'factory_girl_rails', '1.1.rc1'
gem 'database_cleaner', '0.7.1'
gem 'spork', '0.9.0'
gem 'launchy'
gem 'capybara'
gem 'capybara-webkit'
gem 'guard', '1.0.1'
gem 'guard-bundler', '0.1.3'
gem 'guard-rspec', '0.6.0'
gem 'guard-spork', '0.5.2'
gem 'growl', '1.0.3'
end
guard 'bundler' do
watch('Gemfile')
end
guard 'spork', wait: 60, cucumber: false, rspec: true, test_unit: false do
watch('config/application.rb')
watch('config/environment.rb')
watch(%r{^config/environments/.+\.rb$})
watch(%r{^config/initializers/.+\.rb$})
watch('Gemfile')
watch('spec/spec_helper.rb')
end
guard 'rspec', version: 2, cli: '--drb --format progress --color' do
watch(%r{^spec/.+_spec\.rb$})
watch(%r{^spec/factories/(.+).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"] }
watch(%r{^spec/support/(.+)\.rb$}) { "spec" }
watch('spec/spec_helper.rb') { "spec" }
watch('app/controllers/application_controller.rb') { "spec/controllers" }
end
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.
ENV["RAILS_ENV"] ||= 'test'
require File.expand_path("../../config/environment", __FILE__)
require 'rspec/rails'
require 'capybara/rspec'
Dir["#{Rails.root}/spec/support/**/*.rb"].each { |file| require file }
RSpec.configure do |config|
config.mock_with :rspec
config.use_transactional_fixtures = false
config.backtrace_clean_patterns = [
/spec\/spec_helper\.rb/,
/lib\/rspec\/(core|expectations|matchers|mocks)/
]
config.before(:suite) do
Capybara.javascript_driver = :webkit
Capybara.default_wait_time = 5
DatabaseCleaner.strategy = :transaction
DatabaseCleaner.start
Rails.cache.clear
end
config.after(:suite) do
DatabaseCleaner.clean
end
end
end
Spork.each_run do
load "#{Rails.root}/config/routes.rb"
Dir["#{Rails.root}/app/**/*.rb"].each {|f| load f}
Dir["#{Rails.root}/lib/**/*.rb"].each {|f| load f}
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment