Permalink
Browse files

fix fixtures test as table_name is a string now

  • Loading branch information...
1 parent c6efa0d commit 6e46b3bc27c57cf50cf43d0cbe1344956e5998f3 @lest lest committed Jan 26, 2012
Showing with 2 additions and 2 deletions.
  1. +2 −2 activerecord/test/cases/fixtures_test.rb
@@ -782,7 +782,7 @@ def test_named_accessor_for_randomly_named_namespaced_fixture_and_class
end
def test_table_name_is_defined_in_the_model
- assert_equal :randomly_named_table, ActiveRecord::Fixtures::all_loaded_fixtures["admin/randomly_named_a9"].table_name
- assert_equal :randomly_named_table, Admin::ClassNameThatDoesNotFollowCONVENTIONS.table_name
+ assert_equal 'randomly_named_table', ActiveRecord::Fixtures::all_loaded_fixtures["admin/randomly_named_a9"].table_name
@alexeymuranov

alexeymuranov Jan 26, 2012

Contributor

I would prefer the table name to be returned as a symbol by default.

@alexeymuranov

alexeymuranov Jan 26, 2012

Contributor

How about a more flexible test:

assert_equal :randomly_named_table, ActiveRecord::Fixtures::all_loaded_fixtures["admin/randomly_named_a9"].table_name.to_sym

?

@tenderlove

tenderlove Jan 26, 2012

Owner

I'd rather it's returned as a string for a couple reasons: 1) symbols are not GC'd, 2) this is data that describes structure, domain data. Basically what Josh says.

@alexeymuranov

alexeymuranov Jan 26, 2012

Contributor

Ok, i'll read this post to see what the official philosophy is. Mine was that symbols are good for strings that are not intended to be further parsed, and that are used as identifiers.

@alexeymuranov

alexeymuranov Jan 26, 2012

Contributor

It is a good point that symbols are not garbage collected, but dynamically generated method names are symbols, aren't they? Table names are not more likely to change or disappear in run-time than field names are.

@alexeymuranov

alexeymuranov Jan 26, 2012

Contributor

Ok, i am convinced that strings for table names are better. Generated method names do not have to coincide literally with field names, so they are not so much of a domain data.

+ assert_equal 'randomly_named_table', Admin::ClassNameThatDoesNotFollowCONVENTIONS.table_name
end
end

0 comments on commit 6e46b3b

Please sign in to comment.