shoulda-matchers icon indicating copy to clipboard operation
shoulda-matchers copied to clipboard

Simple one-liner tests for common Rails functionality

Results 77 shoulda-matchers issues
Sort by recently updated
recently updated
newest added

Spelling fix - validates_absence_of to validate_absence_of i.e validates_* to validate_*

Consider we have a parent model with uniqueness validation with scope: ```ruby class ParentModel < ActiveRecord::Base validates :column_1, uniqueness: { scope: :column_2 } end class ChildModel1 < ParentModel end class...

To figure out what needs to change, we start by adding it to be tested. I fully expect this to explode fantastically at first. cc https://github.com/thoughtbot/shoulda-matchers/issues/1469

There doesn't appear to be direct support for [ActiveRecord's "new" numericality `in:` range](https://guides.rubyonrails.org/active_record_validations.html#numericality) check: ```ruby class MyRecord < ApplicationRecord validates :progress, numericality: { in: 0..100 } end ``` Attempting to...

https://github.com/thoughtbot/shoulda-matchers/blob/main/lib/shoulda/matchers/active_model/validate_absence_of_matcher.rb - lists "validate_absence_of" as "validates_absence_of" i.e validates instead of validate.

Hi, I loved using shoulda matchers in my rails apps, but have been using flask apps in Python more recently, and testing them with pytest. Are you aware of any...

# Problem When `errors.format` translation is defined differently than `%{attribute} %{message}`, a test using `validate_presence_of` matcher with `strict` seems not to be proved. ## Example If the translations are defined...

I have a class that includes a number of ActiveModel modules. I removed the (hopefully unnecessary) rest of the code for clarity. Using RSpec and FactoryBot. ```ruby # app/models/evaluation.rb class...

Hi! I have one model with two column (applicant_id and career_id) and both are foreign keys. When I a try to validate applicant_id or career_id is uniqueness should validate_uniqueness_of(:applicant_id) or...

🕷 Issue: Bug
🙏 Issue: PR Welcome

I'm upgrading `shoulda-matchers` to `4.5.1` and the following test: ```ruby should route(:get, '/stats/api/applications/42/usage').to(id: '42') ``` returns the following output: ``` Error: Stats::Api::ApplicationsControllerTest#test_: Stats::Api::ApplicationsController should route GET /stats/api/applications/42/usage to/from {:id=>"42", :action=>"usage",...