Skip to content
This repository was archived by the owner on Apr 17, 2018. It is now read-only.

validates_presence_of doesn't expect a space #55

Description

@nathanl

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?

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions