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?
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
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
Now, this makes sense. Thanks. Ruby Koans is great, but I think it
should have some explanation in comments about why
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
Now, this makes sense. Thanks. Ruby Koans is great, but I think it
should have some explanation in comments about the concept.
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.