Skip to content

Commit

Permalink
prevent to run fixture accessor (e.g. test_foos for TestFoo model) as…
Browse files Browse the repository at this point in the history
… a test case [#2992 state:resolved]

Signed-off-by: Wijnand Wiersma <wijnand@videre.net>
Signed-off-by: José Valim <jose.valim@gmail.com>
  • Loading branch information
no6v authored and josevalim committed May 16, 2010
1 parent 9ef232a commit 5d0afe7
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
1 change: 1 addition & 0 deletions activerecord/lib/active_record/fixtures.rb
Expand Up @@ -891,6 +891,7 @@ def setup_fixture_accessors(table_names = nil)

instances.size == 1 ? instances.first : instances
end
private table_name
end
end

Expand Down
5 changes: 5 additions & 0 deletions activerecord/test/cases/fixtures_test.rb
Expand Up @@ -256,6 +256,11 @@ def test_without_complete_instantiation
def test_fixtures_from_root_yml_without_instantiation
assert !defined?(@unknown), "@unknown is not defined"
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
Expand Down

0 comments on commit 5d0afe7

Please sign in to comment.