Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

validates_presence_of doesn't expect a space #55

Open
nathanl opened this Issue May 12, 2012 · 0 comments

Comments

Projects
None yet
1 participant

nathanl commented May 12, 2012

Using validates_presence_of(:description), I'm getting this error:

Expected errors to include "Description must not be blank" when description is set to nil, got errors: ["Description must not be blank "]

The only difference between the expected and actual error is a space at the end.

Note that if I write my own validation, the actual error message doesn't have a space at the end.

it "should validate the presence of description" do
  @robot.description = nil
  @robot.valid?
  @robot.errors.full_messages.should include("Description must not be blank")
end

How can I either cause the error not to have a space or specify the expected message as having one?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment