Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Rspec matchers to test ActiveModel validation that follows BDD.
Ruby

Merge pull request #18 from lukerollans/master

Fix syntax error in usage example
latest commit 5445c22bc2
@bogdan authored

README.md

AcceptValuesFor

Writing specs for complex validations is annoying. AcceptValuesFor makes it easy to test your validations with real world values, asserting which values should be accepted by your model and which should not.

Read the original blog post.

Gem Version Build Status Code Climate

Usage

describe User do
  describe "validation" do
    subject(:user) { User.new }

    it { should accept_values_for(:email, "john@example.com", "jane@example.org") }
    it { should_not accept_values_for(:email, nil, " ", "john", "john@example") }
  end
end

Dependencies

  • Active Model (3 or 4)
  • RSpec (2)

Installation

Gemfile

group :test do
  gem "accept_values_for"
end

Self-Promotion

Like AcceptValuesFor?

Watch the repository on GitHub and read my blog.

Something went wrong with that request. Please try again.