After updating my externals to Rails 0.14.1, I ran into a few snags. First one is a difference in the handling of boolean attributes between both versions. I had the following assertion:
1 class EstimateTest < Test::Unit::TestCase 2 def test_converts_base_information_to_quote 3 # ... 4 assert_equal e.pst_active, q.pst_active, 'copied pst active' 5 end 6 end
q is an instance of Quote, and e is an instance of Estimate. In both cases, pst_active determines if the provincial tax is active. It is a boolean attribute, but I had forgotten to use the attr_name? form. In 0.13.1, this worked, but with 0.14.1, it failed with the following:
1 1) Failure: 2 test_converts_base_information_to_quote(EstimateTest) [./test/unit/estimate_test.rb:493]: 3 copied pst active. 4 <1> expected but was 5 <true>.
When I switched both calls to pst_active to the boolean form, the assertion passed again.
Next, I had 44 failures in my functionnal tests:
1 44) Error: 2 test_destroyed_pictures_dont_appear_in_the_slideshow(WelcomeControllerTest): 3 TypeError: cannot convert Symbol into String 4 D:/rails-app/config/../lib/productize.rb:38:in `+' 5 D:/rails-app/config/../lib/productize.rb:38:in `full_template_path'
This application makes use of the Rails Product Generator. Notice the bug is in
lib/productize.rb, and not my code per se. Line 38 of lib/productize.rb looks like this:
1 site_specific_path = File.join(SITE_ROOT, 'app', 'views', template_path + '.' + extension)
I corrected the error by simply calling to_s on both template_path and extension.
After that, my tests ran perfectly ! Shows how important it is to have even a minimal test suite.