Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Use reflection to spec ActiveModel validations
branch: master

bump version to 2.0.0

[skip ci]
latest commit e3d4b76712
Byron Bowerman authored
Failed to load latest commit information.
lib bump version to 2.0.0
spec fixup: improve handling of validator options
.gitignore
.rspec import basic structure
.travis.yml we don't sudo
Gemfile don't install debugging gems on travis
README.md Merge pull request #7 from BM5k/rspec-3
Rakefile
validation_matcher.gemspec rspec 3 support

README.md

Validation Matcher code climate build status gem version

About

Use Rails validation reflection to test validations.

URLs:

Installation

Add to your Gemfile and run the bundle command to install it.

  gem 'validation_matcher'
  • specify '~> 1.1.0' for rails 4 & rspec 2
  • specify '~> 1.0.0' for rails 3 & rspec 2

Requires Ruby 1.9.2 or later.

Usage

  class Foo < ActiveRecord::Base
    validates :field_a, presence: true
    validates :field_b, uniquness: true
    validates :field_c, presence: true, uniquness: {case_insensitive: false}
  end

  require 'spec_helper'

  describe Foo do
    it { should validate(:presence).of(:field_a) }
    it { should validate(:presence).of(:field_b) }
    it { should validate(:presence).of(:field_c).with(case_insensitive: false) }
    it { should validate(:uniqueness).of(:field_b).with(options) }
  end
Something went wrong with that request. Please try again.