Sha256: abd60b5cd013a0028bf01743a68b2fda92e168e71e649d2083d37e08fc7b4188
Contents?: true
Size: 667 Bytes
Versions: 3
Compression:
Stored size: 667 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
3 entries across 3 versions & 1 rubygems