Skip to content

Instantly share code, notes, and snippets.

@deJaVisions
Created March 31, 2012 16:48
Show Gist options
  • Select an option

  • Save deJaVisions/2266669 to your computer and use it in GitHub Desktop.

Select an option

Save deJaVisions/2266669 to your computer and use it in GitHub Desktop.
my working automated test::unit setup now with guard/spork working nicely together, and much faster test
group :development do
gem 'ruby-prof'
gem 'guard-spork'
end
group :development, :test do
gem 'test-unit', '2.4.8'
gem 'spork', '~> 1.0rc'
gem 'spork-testunit'
gem 'rb-fsevent', '0.4.3.1', :require => false
gem 'guard-test', '0.4.3'
gem 'guard-livereload'
gem 'factory_girl_rails', '1.4.0'
gem 'faker'
end
group :test do
gem 'capybara', '1.1.2'
gem 'shoulda', '3.0.1'
gem 'mocha', '0.10.5'
gem 'turn', '0.9.4'
gem 'minitest'
gem 'database_cleaner'
gem 'growl', '1.0.3'
end
refactor to be slightly less ugly, and with the regex i added it doesn't require integration tests to have controller names in their filenames,when you modify a controller
# A sample Guardfile
# More info at https://github.com/guard/guard#readme
guard :test do
watch(%r{^lib/(.+)\.rb$}) { |m| "test/#{m[1]}_test.rb" } # lib dir mods
watch(%r{^test/.+_test\.rb$}) # anything in any test dir mods
watch('test/test_helper.rb') { "test" } # test_helper mods get a full sweep test
# for when we modify models
watch(%r{^app/models/(.+)\.rb$}) { |m| "test/unit/#{m[1]}_test.rb" }
# this is for when we modify our public controllers
watch(%r{^app/controllers/(.+)\.rb$}) do |m|
"test/integration/#{m[1]}_test.rb"
end
# this is for when we modify our admin controllers
# make it so we don't have to have a controller in our integration tests filenames
watch (%r{^app/controllers/admin/(.+)\.rb$}) do |m|
"test/integration/admin/#{m[1].gsub!(/_controller/, '')}_test.rb"
end
# when views get modified..
watch(%r{^app/views/.+\.rb$}) { "test/integration" }
# when the application controller get's modified
watch('app/controllers/application_controller.rb') { "test/integration" }
end
guard :spork, :test_unit => true, :test_unit_env => { 'RAILS_ENV' => 'test' } do
watch('config/application.rb')
watch('config/environment.rb')
watch(%r{^config/environments/.+\.rb$})
watch(%r{^config/initializers/.+\.rb$})
watch('Gemfile')
watch('Gemfile.lock')
watch('test/test_helper.rb') { :test_unit }
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment