I'm about halfway through the Rails tutorial (excellent, btw), and have a little question. Is there a reason that this test uses duplicate_user.email = @user.email.upcase
and not the more succinct duplicate_user.email.upcase
?
Here is the full test.
test "email addresses should be unique" do
duplicate_user = @user.dup
duplicate_user.email = @user.email.upcase
@user.save
assert_not duplicate_user.valid?
end
As far as I can tell, the test performs correctly doing it either way.