Skip to content
New issue

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

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

validate_inclusion_of with_message doesn't actually check the message #595

Closed
bgentry opened this issue Oct 5, 2014 · 2 comments
Closed

Comments

@bgentry
Copy link

bgentry commented Oct 5, 2014

Given the following validation:

class MyModel < ActiveRecord::Base
  include ActiveModel::Validations

  validates :letter, presence: true, inclusion: { in: %w{A B C}, message: "must be A B C" }
end

this test will pass, even though the message doesn't match:

require 'rails_helper'

RSpec.describe MyModel, :type => :model do
  it { should validate_inclusion_of(:letter).in_array(%w{A B C}).with_message("BROKEN TEST") }
end
@mcmire
Copy link
Collaborator

mcmire commented Oct 5, 2014

Thanks for reporting this, I will take a closer look soon.

@mcmire
Copy link
Collaborator

mcmire commented Nov 18, 2014

Fixed by #598.

@mcmire mcmire closed this as completed Nov 18, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants