From f06b200817fd17573c79e73485df4a5351cb5874 Mon Sep 17 00:00:00 2001 From: Nobuhiro IMAI Date: Sat, 30 May 2009 14:58:47 +0900 Subject: [PATCH] make fixture accessors private prevent to be run fixture accessor (e.g. test_foos for TestFoo model) as a test case --- activerecord/lib/active_record/fixtures.rb | 1 + activerecord/test/cases/fixtures_test.rb | 5 +++++ 2 files changed, 6 insertions(+), 0 deletions(-) diff --git a/activerecord/lib/active_record/fixtures.rb b/activerecord/lib/active_record/fixtures.rb index 2b0cfc2..60d9a4a 100644 --- a/activerecord/lib/active_record/fixtures.rb +++ b/activerecord/lib/active_record/fixtures.rb @@ -888,6 +888,7 @@ module ActiveRecord instances.size == 1 ? instances.first : instances end + private table_name end end diff --git a/activerecord/test/cases/fixtures_test.rb b/activerecord/test/cases/fixtures_test.rb index b07d4f3..e0f92fe 100644 --- a/activerecord/test/cases/fixtures_test.rb +++ b/activerecord/test/cases/fixtures_test.rb @@ -254,6 +254,11 @@ class FixturesWithoutInstantiationTest < ActiveRecord::TestCase assert_nil @unknown end + def test_visibility_of_accessor_method + assert_equal false, respond_to?(:topics, false), "should be private method" + assert_equal true, respond_to?(:topics, true), "confirm to respond surely" + end + def test_accessor_methods assert_equal "The First Topic", topics(:first).title assert_equal "Jamis", developers(:jamis).name -- 1.6.3.1