Sha256: 43d76552fc7a5bf6f3ddbceddacdc8fa180ba0182a4cecf014cf9dc95d98fd36
Contents?: true
Size: 837 Bytes
Versions: 17
Compression:
Stored size: 837 Bytes
Contents
require 'teststrap' context "validates presence" do should "add a validation macro" do WhyValidationsSuckIn96::ValidationBuilder.instance_methods end.includes('validates_presence_of') context "validating an object" do validatable = OpenStruct.new(:message => "foo") setup do WhyValidationsSuckIn96::ValidatesPresence.new(validatable, :attribute => :message) end should "have a message accessor with a default message" do topic.message end.equals("is not present") should "fail if the attribute is blank" do validatable.message = "" topic.validates? end.equals(false) should "pass if the attribute is non blank" do validatable.message = "blah" topic.validates? end end # validating an object end # validates presence
Version data entries
17 entries across 17 versions & 1 rubygems