ONJava.com -- The Independent Source for Enterprise Java
oreilly.comSafari Books Online.Conferences.

advertisement

AddThis Social Bookmark Button
Article:
  Cookin' with Ruby on Rails - Designing for Testability
Subject:   Suggestions
Date:   2007-07-24 11:59:56
From:   DaveMatuszek
Great article! I think I'm getting the hang of this!


I'm about to subject my class of ~30 unsuspecting students to the first tutorial in this series. (Maybe, if it goes fast enough, the second as well.)



Mino typos: There are missing close parens in category_test.rb test_create_and_destroy:
assert_equal(initial_rec_count + 1, Category.count
and in the same method in recipe_test.rb:
assert_equal(initial_rec_count + 1,Recipe.count


I had to work my way through the following code:
partial_name = ''
'a'.upto('y') {|letter| partial_name << letter}
rec_with_borderline_name = Category.new(:name => (partial_name * 4))

I think the following is clearer, and therefore less distracting from the point you are making:
rec_with_borderline_name = Category.new(:name => ("a" * 100))


Actually, I used
max_length = 100
rec_with_borderline_name = Category.new(:name => ("a" * max_length))

in order to avoid a "magic number." Now, if I can only figure out a way to get that number from the database itself....


Again, great job, and very helpful. Thank you!


1 to 1 of 1
  1. Suggestions
    2007-08-21 09:09:06  Bill Walton | [View]

1 to 1 of 1