This gem provides an rspec matcher that helps you to test ActiveModel validation.
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.
- ActiveModel
- Rspec
group :test do
gem 'accept_values_for'
end
Like accept_values_for?
Follow the repository on GitHub.
Read author blog.