Awesome Open Source
Awesome Open Source
Sponsorship

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, "[email protected]", "[email protected]") }
    it { should_not accept_values_for(:email, nil, " ", "john", "[email protected]") }
  end
end

Dependencies

  • Active Model (5 or 6)
  • RSpec (3)

Installation

Gemfile

group :test do
  gem "accept_values_for"
end

Self-Promotion

Like AcceptValuesFor?

Watch the repository on GitHub and read my blog.


Get A Weekly Email With Trending Projects For These Topics
No Spam. Unsubscribe easily at any time.
ruby (12,202
validation (299
rspec (59

Find Open Source By Browsing 7,000 Topics Across 59 Categories