Skip to content

Rspec matchers to test ActiveModel validation that follows BDD.

License

Notifications You must be signed in to change notification settings

icicle/accept_values_for

 
 

Repository files navigation

Accept values for

Description

This gem provides an rspec matcher that helps you to test ActiveModel validation.

Usage

RSpec matcher to test the validation

describe User do

  subject { User.new(@valid_attributes)}
  
  it { should accept_values_for(:email, "john@example.com", "lambda@gusiev.com") }
  it { should_not accept_values_for(:email, "invalid", nil, "a@b", "john@.com") }
end

You can specify which values should be accepted by model as valid and which values should not be accepted as invalid.

Dependencies

  • ActiveModel
  • Rspec

Install

Gemfile

group :test do
  gem 'accept_values_for'
end

Self-Promotion

Like accept_values_for?

Follow the repository on GitHub.

Read author blog.

About

Rspec matchers to test ActiveModel validation that follows BDD.

Resources

License

Stars

Watchers

Forks

Packages

No packages published