Class: Peck::Should
- Inherits:
-
Object
- Object
- Peck::Should
- Defined in:
- lib/peck_on_rails.rb,
lib/peck_on_rails.rb
Defined Under Namespace
Classes: Disallow, RequireLogin, Response, ResponseRequirement, Specification
Instance Method Summary collapse
Instance Method Details
#validate_with(attribute, value) ⇒ Object
358 359 360 361 362 363 364 365 366 367 368 |
# File 'lib/peck_on_rails.rb', line 358 def validate_with(attribute, value) = "Expected #{!@negated ? 'no' : ''}errors on #{attribute.inspect} with value `#{value.inspect}' after validation" @this.send("#{attribute}=", value) @this.valid? if @this.errors[attribute].kind_of?(Array) satisfy() { @this.errors[attribute].empty? } else satisfy() { @this.errors[attribute].nil? } end end |