Thu Sep 22
#
“ [I]t makes me sick just thinking about it. [N]o program should be that big (25,000 lines) - just like no soda should be 64 ounces. ”
Ara. T. Howard
#
Easily assert that records are correctly ordered in functional tests
def assert_ascending(collection) previous_value = yield collection.first assert(collection[1..-1].all? do |current| returning(previous_value <= (current_value = yield current)) do previous_value = current_value end end) end def assert_descending(collection, &block) assert_ascending collection.reverse, &block end # Test that @people is ordered by company name assert_ascending assigns(:people) do |person| person.company.name.downcase end
#
#rubyist.org
16:33 <@Ulysses> my sub just exploded bbq sauce all over my shirt
16:33 <@Ulysses> ... that girl fails it as a bbq sauce applicator
16:34 <@Ulysses> she did not shake it at all and it is way too fluid
16:36 <@htonl> go back and throw it in her face
#
Tip Rake task dry-run
You can see what a Rake task would do without having it actually do it by passing in the -n option.
$ rake test_functional -n ** Invoke test_functional (first_time) ** Invoke test_environment (first_time) ** Execute (dry run) test_environment ** Invoke create_db (first_time) ** Invoke destroy_db (first_time) ** Invoke environment (first_time) ** Execute (dry run) environment ** Execute (dry run) destroy_db ** Execute (dry run) create_db ** Execute (dry run) test_functional