Ran
|
Files
28
|
Run time
1s
|
Badge
Embed ▾
README BADGES
|
push
travis-ci
Make conditionals more inline with guides The Ruby on Rails guide contains the following example ``` class Computer < ApplicationRecord validates :mouse, presence: true, if: ["market.retail?", :desktop?], unless: Proc.new { |c| c.trackpad.present? } end ``` Arrays and Strings were not supported before. https://github.com/rails/rails/blob/38fe5ae24/activesupport/lib/active_support/callbacks.rb#L429-L458 was used for inspiration. Initially I handled a Symbol case, and raised an error if something unexpected is passed, but that creates more than 100 lines in the module, and rubocop complains. So I kept the code sending a message if something other than a Proc or a String is passed.
576 of 579 relevant lines covered (99.48%)
21.56 hits per line
Coverage | ∆ | File | Lines | Relevant | Covered | Missed | Hits/Line |
---|