Sha256: eb8a5ccda1fa67c0532b5f694fc86e69e77e16c121e29932a340e24e02775f75
Contents?: true
Size: 837 Bytes
Versions: 1
Compression:
Stored size: 837 Bytes
Contents
require "minitest" module Minitest module Checks class Models < Base def self.valid(params) valids([params]) end def self.valids(arr) arr.each { |params| one_valid(params) } end def self.invalid(params) invalids([params]) end def self.invalids(arr) arr.each { |params| one_invalid(params) } end def self.one_valid(params) row, msg = create_model(params) @minitest.assert row.valid?, "#{msg} #{row.errors.full_messages}" end def self.one_invalid(params) row, msg = create_model(params) @minitest.refute row.valid?, "#{msg} expected to be invalid" end def self.create_model(params) row = @klass.create(params) [row, "#{@klass}: #{params}"] end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
mimoco-1.0.0 | lib/mimoco_valid.rb |