I have started my journey with TDD in Rails and have run into a small issue regarding tests for model validations that I can\'t seem to find a solution to. Let\'s say I have a U
Try this:
it "should require a username" do user = User.create(:username => "") user.valid? user.errors.should have_key(:username) end