Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
ActiveModel::Lint tests for MiniTest 5
shared_examples_for "ActiveModel" do
require 'minitest/assertions'
require 'active_model/lint'
include MiniTest::Assertions
include ActiveModel::Lint::Tests
# This is the main difference between MiniTest 4 and 5.
# We must keep a counter of assertions.
attr_accessor :assertions
before do
@model = subject
@assertions = 0
end { |method|
}.grep(/^test/).each do |method|
example(method.gsub('_', ' ')) { send method }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.