Shoulda Matcher

Public
Shoulda Matchers provides RSpec- and Minitest-compatible one-liners to test common Rails functionality that, if written by hand, would be much longer, more complex, and error-prone.
Icons/chart bar
Used 24 times
Created by
E Emanuele Bonanno

Usage

Run this command in your Rails app directory in the terminal:

rails app:template LOCATION="https://railsbytes.com/script/x7msLr"
Template Source

Review the code before running this template on your machine.

inject_into_file 'Gemfile', after: 'group :development, :test do' do
<<-RUBY
  gem "shoulda-matchers"
RUBY
end

after_bundle do
  file 'spec/support/shoulda_matchers.rb', <<~CODE
    Shoulda::Matchers.configure do |config|
      config.integrate do |with|
        with.test_framework :rspec
        with.library :rails
      end
    end
  CODE
end
Comments

Sign up or Login to leave a comment.