Sha256: 246ccaa13356d47b4a669c87b2db1f9b1a9f300afe9eca42b284cd5857103ec2

Contents?: true

Size: 1.69 KB

Versions: 16

Compression:

Stored size: 1.69 KB

Contents

require File.expand_path(File.dirname(__FILE__) + '/../test_helper')

Expectations do
  expect "message" do
    errors = Validatable::Errors.new
    errors.add(:attribute, "message")
    errors.on(:attribute)
  end
  
  expect ["message"] do
    errors = Validatable::Errors.new
    errors.add(:attribute, "message")
    errors.raw(:attribute)
  end
  
  expect "something new" do
    errors = Validatable::Errors.new
    errors.add(:attribute, "something old")
    errors.replace(:attribute, ["something new"])
    errors.on(:attribute)
  end
  
  expect "Capitalized word" do
    errors = Validatable::Errors.new
    errors.humanize("capitalized_word")
  end
  
  expect "Capitalized word without" do
    errors = Validatable::Errors.new
    errors.humanize("capitalized_word_without_id")
  end
  
  expect ["A humanized message", "a base message"] do
    errors = Validatable::Errors.new
    errors.add(:base, "a base message")
    errors.add(:a_humanized, "message")
    errors.full_messages.sort
  end
  
  expect true do
    Validatable::Errors.included_modules.include?(Enumerable)
  end
  
  expect ["message1", "message2"] do
    errors = Validatable::Errors.new
    errors.add(:attribute, "message1")
    errors.add(:attribute, "message2")
    errors.on(:attribute)
  end
  
  expect 2 do
    errors = Validatable::Errors.new
    errors.add(:attribute, "message1")
    errors.add(:attribute, "message2")
    errors.count
  end 
  
  expect 2 do
    errors = Validatable::Errors.new
    errors.add(:attribute1, "message1")
    errors.add(:attribute2, "message2")
    errors.count
  end
  
  expect "message" do
    errors = Validatable::Errors.new
    errors.add(:attribute, "message")
    errors[:attribute]
  end
end

Version data entries

16 entries across 16 versions & 3 rubygems

Version Path
hashrocket-validatable-1.7.4 test/unit/test_errors.rb
jnunemaker-validatable-1.8.2 test/unit/test_errors.rb
jnunemaker-validatable-1.1.10 test/unit/test_errors.rb
jnunemaker-validatable-1.1.9 test/unit/test_errors.rb
durran-validatable-2.0.1 test/unit/test_errors.rb
durran-validatable-2.0.0 test/unit/test_errors.rb
durran-validatable-1.8.4 test/unit/test_errors.rb
durran-validatable-1.8.3 test/unit/test_errors.rb
jnunemaker-validatable-1.8.1 test/unit/test_errors.rb
durran-validatable-1.8.2 test/unit/test_errors.rb
durran-validatable-1.8.1 test/unit/test_errors.rb
durran-validatable-1.8.0 test/unit/test_errors.rb
durran-validatable-1.7.5 test/unit/test_errors.rb
jnunemaker-validatable-1.8.0 test/unit/test_errors.rb
jnunemaker-validatable-1.7.4 test/unit/test_errors.rb
jnunemaker-validatable-1.7.3 test/unit/test_errors.rb