Hello,
So I''ve just upgraded to 0.11.1 from 0.10.1, and now my unit tests
have all exploded. They worked fine previously, but now every single
one of my unit tests errors out with some message about there being no
"gsub!" method for the Time class (even though none of my tests
actually attempt to use this method). Here is an example of one of the
8 errors:
1) Error:
test_crud(ArticleTest):
NoMethodError: private method `gsub!'' called for Mon Mar 28 22:24:12
MST 2005:Time
/usr/lib/ruby/1.8/date/format.rb:238:in `_parse''
/usr/lib/ruby/1.8/parsedate.rb:9:in `parsedate''
/usr/lib/ruby/gems/1.8/gems/activerecord-1.9.1/lib/active_record/connection_adapters/abstract_adapter.rb:209:in
`string_to_date''
/usr/lib/ruby/gems/1.8/gems/activerecord-1.9.1/lib/active_record/connection_adapters/abstract_adapter.rb:187:in
`type_cast''
/usr/lib/ruby/gems/1.8/gems/activerecord-1.9.1/lib/active_record/base.rb:1174:in
`read_attribute''
/usr/lib/ruby/gems/1.8/gems/activerecord-1.9.1/lib/active_record/base.rb:1052:in
`attributes''
/usr/lib/ruby/gems/1.8/gems/activerecord-1.9.1/lib/active_record/base.rb:1048:in
`inject''
/usr/lib/ruby/gems/1.8/gems/activerecord-1.9.1/lib/active_record/base.rb:1048:in
`each''
/usr/lib/ruby/gems/1.8/gems/activerecord-1.9.1/lib/active_record/base.rb:1048:in
`inject''
/usr/lib/ruby/gems/1.8/gems/activerecord-1.9.1/lib/active_record/base.rb:1048:in
`attributes''
/usr/lib/ruby/gems/1.8/gems/activerecord-1.9.1/lib/active_record/base.rb:1259:in
`attributes_with_quotes''
/usr/lib/ruby/gems/1.8/gems/activerecord-1.9.1/lib/active_record/base.rb:1351:in
`quoted_column_names''
/usr/lib/ruby/gems/1.8/gems/activerecord-1.9.1/lib/active_record/base.rb:1120:in
`create_without_callbacks''
/usr/lib/ruby/gems/1.8/gems/activerecord-1.9.1/lib/active_record/callbacks.rb:264:in
`create_without_timestamps''
/usr/lib/ruby/gems/1.8/gems/activerecord-1.9.1/lib/active_record/timestamp.rb:29:in
`create''
/usr/lib/ruby/gems/1.8/gems/activerecord-1.9.1/lib/active_record/base.rb:1102:in
`create_or_update_without_callbacks''
/usr/lib/ruby/gems/1.8/gems/activerecord-1.9.1/lib/active_record/callbacks.rb:252:in
`create_or_update''
/usr/lib/ruby/gems/1.8/gems/activerecord-1.9.1/lib/active_record/base.rb:935:in
`save_without_validation''
/usr/lib/ruby/gems/1.8/gems/activerecord-1.9.1/lib/active_record/validations.rb:562:in
`save_without_transactions''
/usr/lib/ruby/gems/1.8/gems/activerecord-1.9.1/lib/active_record/transactions.rb:121:in
`save''
/usr/lib/ruby/gems/1.8/gems/activerecord-1.9.1/lib/active_record/transactions.rb:121:in
`transaction''
/usr/lib/ruby/gems/1.8/gems/activerecord-1.9.1/lib/active_record/transactions.rb:87:in
`transaction''
/usr/lib/ruby/gems/1.8/gems/activerecord-1.9.1/lib/active_record/transactions.rb:113:in
`transaction''
/usr/lib/ruby/gems/1.8/gems/activerecord-1.9.1/lib/active_record/transactions.rb:121:in
`save''
./test/unit/article_test.rb:38:in `test_crud''
(the other 7 are the same, just substitute in different names for
"test_crud"). This is the test:
def test_crud
# Create a new article and assert that it''s attributes are correct
# This will have id 3 unless you add more fixtures
new = Article.new({
"category_id" => 1,
"title" => "foobar",
"slug" => "foobar-bazqux",
"body" => "this is an article about nothing",
"blurb" => "really, nothing to it",
"public" => true})
assert_equal new.title, "foobar"
assert_equal new.blurb, "really, nothing to it"
# Save the article, read it back, and assert that they''re the same
total = Article.find_all.size
assert new.save
two = Article.find(3)
assert_equal new, two
assert_equal total+1, Article.find_all.size
# Change it, read it back yet again, assert it''s still the same
assert two.update_attributes({"title" => two.title.reverse})
assert_equal Article.find(two.id).title, new.title.reverse
# Destroy them!
assert_not_nil Article.find(3)
assert new.destroy
assert two.destroy
assert_raise (ActiveRecord::RecordNotFound) { Article.find(3) }
end
Again, like I said, this test (and the others) all worked perfectly
before the upgrade and none of the tests use gsub! at all though
that''s what''s causing the tests to explode.
Anybody have any idea what''s going on? I''m not comfortable
going live
with the upgrade until the tests can be fixed.
--
Urban Artography
http://artography.ath.cx