Sha256: 2d7fd6bae604033f7e7ed17ecf57d19bf3bae18fb99faa02c2deff31d35ffc98
Contents?: true
Size: 669 Bytes
Versions: 37
Compression:
Stored size: 669 Bytes
Contents
module ModelHelpers def self.included(includee) includee.extend(ClassMethods) end module ClassMethods # Is a document (looked up from +symbol+) missing +key+? # # @param [Symbol] document # # @param [Symbol] missing def missing_key(symbol, key) test "should be invalid" do document = instance_variable_get("@#{symbol}") assert_equal false, document.valid? end test "should have errors" do document = instance_variable_get("@#{symbol}") document.valid? expected = "can't be empty" assert_include expected, document.errors.errors[key] end end end end
Version data entries
37 entries across 37 versions & 1 rubygems