From: Josh Cheek Date: 2010-12-15T09:56:18+09:00 Subject: Re: Ruby Koans: about_hashes.rb --001485f92a8827de460497686791 Content-Type: text/plain; charset=ISO-8859-1 On Wed, Dec 8, 2010 at 5:38 PM, skim wrote: > That sounds about right. Readability. > > On Wed, Dec 8, 2010 at 11:55, Ilya B. wrote: > > > Question about this method in Ruby Koans -> about_hashes.rb > > > > def test_changing_hashes > > hash = { :one => "uno", :two => "dos" } > > hash[:one] = "eins" > > > > expected = { :one => "eins", :two => "dos" } > > assert_equal true, expected == hash > > > > # Bonus Question: Why was "expected" broken out into a variable > > # rather than used as a literal? > > end > > > > Referring to the bonus question, is there any reason other than that > > it's more readable this way? Seems to accomplish the same thing? > > > > -- > > Posted via http://www.ruby-forum.com/. > > > > > If that were true, shouldn't it be: assert_equal expected , hash I think it is probably a mistake, and they meant to try and show that you can't do either of these, because it looks like you are passing a block. assert_equal { :one => "eins", :two => "dos" } , hash assert { :one => "eins", :two => "dos" } == hash --001485f92a8827de460497686791--