Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

make fixture accessors private

prevent to be run fixture accessor (e.g. test_foos for TestFoo model) as a test case

Signed-off-by: José Valim <jose.valim@gmail.com>
  • Loading branch information...
commit e535b45c8661a29a04f46e1b8cc9af9fc59c6393 1 parent 3570f3e
@no6v no6v authored josevalim committed
View
1  activerecord/lib/active_record/fixtures.rb
@@ -891,6 +891,7 @@ def setup_fixture_accessors(table_names = nil)
instances.size == 1 ? instances.first : instances
end
+ private table_name
end
end
View
5 activerecord/test/cases/fixtures_test.rb
@@ -254,6 +254,11 @@ def test_fixtures_from_root_yml_without_instantiation
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
Please sign in to comment.
Something went wrong with that request. Please try again.