Sha256: e65a3b31aeb14d4f57d3ce8e1f013206cdbebb032e1a83f1206ed0b8ee69be05

Contents?: true

Size: 673 Bytes

Versions: 50

Compression:

Stored size: 673 Bytes

Contents

# see: http://iain.nl/testing-activerecord-in-isolation
module ActiveModel::Validations
  # Extension to enhance `should have` on AR Model instances.  Calls
  # model.valid? in order to prepare the object's errors object.
  #
  # You can also use this to specify the content of the error messages.
  #
  # @example
  #
  #     model.should have(:no).errors_on(:attribute)
  #     model.should have(1).error_on(:attribute)
  #     model.should have(n).errors_on(:attribute)
  #
  #     model.errors_on(:attribute).should include("can't be blank")
  def errors_on(attribute)
    self.valid?
    [self.errors[attribute]].flatten.compact
  end
  alias :error_on :errors_on
end

Version data entries

50 entries across 50 versions & 1 rubygems

Version Path
object_attorney-2.10.12 spec/support/active_model/validations.rb
object_attorney-2.10.11 spec/support/active_model/validations.rb
object_attorney-2.10.10 spec/support/active_model/validations.rb
object_attorney-2.10.9 spec/support/active_model/validations.rb
object_attorney-2.10.7 spec/support/active_model/validations.rb
object_attorney-2.10.6 spec/support/active_model/validations.rb
object_attorney-2.10.5 spec/support/active_model/validations.rb
object_attorney-2.10.3 spec/support/active_model/validations.rb
object_attorney-2.10.2 spec/support/active_model/validations.rb
object_attorney-2.10.1 spec/support/active_model/validations.rb
object_attorney-2.9.4 spec/support/active_model/validations.rb
object_attorney-2.9.3 spec/support/active_model/validations.rb
object_attorney-2.9.2 spec/support/active_model/validations.rb
object_attorney-2.9.0 spec/support/active_model/validations.rb
object_attorney-2.8.1 spec/support/active_model/validations.rb
object_attorney-2.8.0 spec/support/active_model/validations.rb
object_attorney-2.6.12 spec/support/active_model/validations.rb
object_attorney-2.6.11 spec/support/active_model/validations.rb
object_attorney-2.6.10 spec/support/active_model/validations.rb
object_attorney-2.6.9 spec/support/active_model/validations.rb