Skip to content

Commit e244357

Browse files
committed
Provide assertions ivar for Minitest.
Minitest requires an assertion var be available to increment inside the class that it is running. Add a module that can be mixed in that provides the methods required. See minitest/minitest@714cd8a
1 parent c67eb34 commit e244357

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

spec/rspec/active_model/mocks/mock_model_spec.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -385,6 +385,7 @@
385385
begin
386386
require 'minitest/assertions'
387387
include Minitest::Assertions
388+
include MinitestAssertion
388389
rescue LoadError
389390
require 'test/unit/assertions'
390391
include Test::Unit::Assertions

spec/support/minitest_support.rb

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# Minitest requires you provide an assertions ivar for the context
2+
# it is running within. We need this so that ActiveModel::Lint tests
3+
# can successfully be run.
4+
module MinitestAssertion
5+
def assertions
6+
@assertions ||= 0
7+
end
8+
9+
def assertions=(value)
10+
@assertions = value
11+
end
12+
end

0 commit comments

Comments
 (0)