test/unit/assertions_tests.rb in assert-2.15.2 vs test/unit/assertions_tests.rb in assert-2.16.0
- old
+ new
@@ -2,10 +2,12 @@
require 'assert/assertions'
module Assert::Assertions
class UnitTests < Assert::Context
+ include Assert::Test::TestHelpers
+
desc "Assert::Context"
setup do
@context_class = Factory.modes_off_context_class
@test = Factory.test
@context = @context_class.new(@test, @test.config, proc{ |r| })
@@ -41,26 +43,27 @@
context_info = Factory.context_info(@context_class)
Factory.test("ignored assertion helper #{helper}", context_info) do
self.send(helper, "doesn't matter")
end
end
- @expected_messages = Assert::Assertions::IGNORED_ASSERTION_HELPERS.map do |helper|
- "The assertion `#{helper}` is not supported."\
- " Please use another assertion or the basic `assert`."
- end
- @results = @tests.map(&:run).flatten
+ @tests.each{ |test| test.run(&test_run_callback) }
end
- subject{ @results }
should "have an ignored result for each helper in the constant" do
- subject.each do |result|
+ exp = Assert::Assertions::IGNORED_ASSERTION_HELPERS.size
+ assert_equal exp, test_run_result_count
+
+ test_run_results.each do |result|
assert_kind_of Assert::Result::Ignore, result
end
- assert_equal(Assert::Assertions::IGNORED_ASSERTION_HELPERS.size, subject.size)
end
should "have a custom ignore message for each helper in the constant" do
- assert_equal(@expected_messages, subject.collect(&:message))
+ exp = Assert::Assertions::IGNORED_ASSERTION_HELPERS.map do |helper|
+ "The assertion `#{helper}` is not supported."\
+ " Please use another assertion or the basic `assert`."
+ end
+ assert_equal exp, test_run_results.collect(&:message)
end
end
end