Sha256: 100e671b2a1bb68e4669299c21eb9751819ff3605d9cbb9f36f45b20541e9626
Contents?: true
Size: 1.31 KB
Versions: 10
Compression:
Stored size: 1.31 KB
Contents
require File.expand_path(File.dirname(__FILE__) + '/../test_helper') class ErrorsTest < Test::Unit::TestCase 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 test "includes enumerable" do assert_equal true, 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 end
Version data entries
10 entries across 10 versions & 1 rubygems