Project

phillumeny

0.0
No commit activity in last 3 years
No release in over 3 years
Collection of RSpec matchers for verbose testers.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
 Dependencies

Development

>= 0
>= 0
 Project Readme

Collection of RSpec matchers for verbose testers.

Configuration

# 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

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

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

# 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