https://github.com/mdeering/phillumeny
Collection of RSpec matchers for verbose testers.
https://github.com/mdeering/phillumeny
activemodel rails rspec ruby
Last synced: about 2 months ago
JSON representation
Collection of RSpec matchers for verbose testers.
- Host: GitHub
- URL: https://github.com/mdeering/phillumeny
- Owner: mdeering
- License: mit
- Created: 2019-01-26T22:47:07.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2019-02-19T03:53:32.000Z (over 7 years ago)
- Last Synced: 2025-10-08T01:55:40.541Z (8 months ago)
- Topics: activemodel, rails, rspec, ruby
- Language: Ruby
- Size: 158 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README

Collection of RSpec matchers for verbose testers.
## Configuration
```ruby
# spec/support/phillumeny.rb
require 'phillumeny'
# require 'phillumeny/active_record'
RSpec.configure do |config|
config.include Phillumeny::ActiveModel, type: :model
config.include Phillumeny::ActiveRecord, type: :model
config.include Phillumeny::FactoryBot, type: :model
end
```
### ActiveModel
```ruby
RSpec.describe Webpage, type: :model do
it { should validate_presence_of_any(:headline, :title).valid_values(title: 'this') }
it { should_not validate_presence_of_any(:headline, :title) }
it { should_not validate_presence_of_any(:headline, :title).valid_value(:title, 'that') }
end
```
### ActiveRecord
```ruby
RSpec.describe Post, type: :model do
[[:include_in_sitemap, :published_at], :published_at].each do |columns|
it { should cover_query_with_indexes(columns) }
end
{
include_in_sitemap: true,
sitemap_change_frequency: 'monthly',
sitemap_priorty: 5,
title: nil
}.each do |attribute, value|
it { should have_default_value_of(value).for(attribute).in_the_database }
end
end
```
## Factory Bot
```ruby
# spec/models/user_spec.rb
require 'spec_helper'
RSpec.describe User, type: :model do
context 'Factories' do
it { should have_a_valid_factory }
it { should_not have_a_valid_factory.with_trait(:something_wrong) }
end
end
```