Skip to content

Instantly share code, notes, and snippets.

@no6v
Created June 9, 2009 03:08
Show Gist options
  • Save no6v/126225 to your computer and use it in GitHub Desktop.
Save no6v/126225 to your computer and use it in GitHub Desktop.
# What?
# Monkey patch for https://rails.lighthouseapp.com/projects/8994/tickets/1708
#
# Where?
# Rails 2.3.2 (gem)
# $ rails test_foo
# $ cd test_foo
# $ ruby script/generate model TestFoo name:string
# $ rake db:migrate RAILS_ENV=test
# $ env RAILS_ENV=test ruby -I test test/unit/test_foo_test.rb -v
# Loaded suite test/unit/test_foo_test
# Started
# test_foos(ActionController::IntegrationTest): .
# test_foos(ActionController::TestCase): .
# test_foos(ActionMailer::TestCase): .
# test_foos(ActionView::TestCase): .
# test_foos(ActiveRecord::TestCase): .
# test_foos(ActiveSupport::TestCase): .
# test_foos(TestFooTest): .
# test_the_truth(TestFooTest): .
#
# Finished in 0.07446 seconds.
#
# 8 tests, 1 assertions, 0 failures, 0 errors
# ^^^^^^^
# How?
# $ cat > config/initializers/suppress_redundant_tests.rb
require "active_record/fixtures"
module ActiveRecord
module TestFixtures
module ClassMethods
def setup_fixture_accessors_with_private(table_names = nil)
setup_fixture_accessors_without_private(table_names).each do |table_name|
private table_name
end
end
alias_method_chain :setup_fixture_accessors, :private
end
end
end
# ^D
#
# When?
# $ env RAILS_ENV=test ruby -I test test/unit/test_foo_test.rb -v
# Loaded suite test/unit/test_foo_test
# Started
# test_the_truth(TestFooTest): .
#
# Finished in 0.059542 seconds.
#
# 1 tests, 1 assertions, 0 failures, 0 errors
# ^^^^^^^
# Who?
# Nobuhiro IMAI <nov@yo.rim.or.jp>
# Key fingerprint = F39E D552 545D 7C64 D690 F644 5A15 746C BD8E 7106
#
# Why?
# Things as they should be. Thanks!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment