No commit activity in last 3 years
No release in over 3 years
RSpec matchers for testing ActiveModel custom validations in isolation from your application's models
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
 Dependencies
 Project Readme

Validation Matchers ¶ ↑

RSpec matchers for testing ActiveModel custom validations in isolation from your application’s models

Install¶ ↑

From the command line

gem install validation_matchers

Using bundler

gem "validation_matchers", "~> 0.1.0"

Usage¶ ↑

Currently we support testing subclasses of ActiveModel::EachValidator.

Use the gem in your specs by including ValidationMatchers::ActiveModel. You will get access to “pass_validate_each” and “fail_validate_each” methods.

Example¶ ↑

require 'validation_matchers/active_model' 

describe MyActiveModelValidator do
  include ValidationMatchers::ActiveModel
  subject { MyActiveModelValidator.new({:attributes=>{}}) }

  it "allows a valid value" do
    subject.should pass_validate_each(:attr, "valid value") 
  end

  it "rejects an invalid value" do
    subject.should fail_validate_each(:attr, "some bad value") 
  end
end