Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/bogdan/accept_values_for
Rspec matchers to test ActiveModel validation that follows BDD.
https://github.com/bogdan/accept_values_for
rspec ruby validation
Last synced: 25 days ago
JSON representation
Rspec matchers to test ActiveModel validation that follows BDD.
- Host: GitHub
- URL: https://github.com/bogdan/accept_values_for
- Owner: bogdan
- License: mit
- Created: 2010-05-04T18:52:55.000Z (over 14 years ago)
- Default Branch: master
- Last Pushed: 2024-09-09T08:55:59.000Z (2 months ago)
- Last Synced: 2024-10-01T03:41:20.576Z (about 1 month ago)
- Topics: rspec, ruby, validation
- Language: Ruby
- Homepage:
- Size: 93.8 KB
- Stars: 106
- Watchers: 5
- Forks: 20
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# 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](http://gusiev.com/2010/06/ultimate-rspec-matcher-to-test-validation/).
[![Gem Version](https://badge.fury.io/rb/accept_values_for.png)](http://badge.fury.io/rb/accept_values_for)
[![Build Status](https://github.com/bogdan/accept_values_for/workflows/CI/badge.svg?branch=master)](https://github.com/bogdan/accept_values_for/actions)
[![Code Climate](https://codeclimate.com/github/bogdan/accept_values_for.png)](https://codeclimate.com/github/bogdan/accept_values_for)## Usage
```ruby
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", "john@example") }
end
end
```## Dependencies
* Active Model (6, 7)
* RSpec (3)## Installation
### Gemfile
```ruby
group :test do
gem "accept_values_for"
end
```## Self-Promotion
Like AcceptValuesFor?
Watch the repository on [GitHub](https://github.com/bogdan/accept_values_for)
and read [my blog](http://gusiev.com).