This was proposed as an idea 4 years ago in 
https://github.com/rails/rails/pull/95. It was closed at that time, but I'd 
like to propose a refreshed version targeted towards ActiveModel and 
Minitest. The gem is at https://github.com/jch/minitest-model.

This feature is more useful today than when it was originally proposed 
because any ActiveModel::Validations standardized the interface used by 
ORMs and general ruby objects. Here is a sample of what it looks like:

class MyTest < ActiveSupport::TestCase
  include Minitest::Model


  test "model requires email" do
    m = Model.new
    refute_valid m, :email


    m.email = "f...@bar.com"
    assert_valid m, :email
  end
end


Failed assertions print a descriptive message of why it failed rather than 
a generic "Expected true" if asserting on just `valid?`.

Thanks!
-Jerry

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Core" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to rubyonrails-core+unsubscr...@googlegroups.com.
To post to this group, send email to rubyonrails-core@googlegroups.com.
Visit this group at http://groups.google.com/group/rubyonrails-core.
For more options, visit https://groups.google.com/d/optout.

Reply via email to