test/unit/assertions/assert_nil_tests.rb in assert-2.4.0 vs test/unit/assertions/assert_nil_tests.rb in assert-2.5.0

- old
+ new

@@ -4,18 +4,19 @@ require 'assert/utils' module Assert::Assertions class AssertNilTests < Assert::Context - desc "the assert_nil helper" + desc "`assert_nil`" setup do desc = @desc = "assert nil empty fail desc" args = @args = [ 1, desc ] @test = Factory.test do assert_nil(nil) # pass assert_nil(*args) # fail end + @c = @test.config @test.run end subject{ @test } should "produce results as expected" do @@ -23,25 +24,26 @@ assert_equal 1, subject.result_count(:pass) assert_equal 1, subject.result_count(:fail) end should "have a fail message with custom and generic explanations" do - exp = "#{@args[1]}\nExpected nil, not #{Assert::U.show(@args[0])}." + exp = "#{@args[1]}\nExpected #{Assert::U.show(@args[0], @c)} to be nil." assert_equal exp, subject.fail_results.first.message end end class AssertNotNilTests < Assert::Context - desc "the assert_not_nil helper" + desc "`assert_not_nil`" setup do desc = @desc = "assert not nil empty fail desc" args = @args = [ nil, desc ] @test = Factory.test do assert_not_nil(1) # pass assert_not_nil(*args) # fail end + @c = @test.config @test.run end subject{ @test } should "produce results as expected" do @@ -49,10 +51,10 @@ assert_equal 1, subject.result_count(:pass) assert_equal 1, subject.result_count(:fail) end should "have a fail message with custom and generic explanations" do - exp = "#{@args[1]}\nExpected #{Assert::U.show(@args[0])} to not be nil." + exp = "#{@args[1]}\nExpected #{Assert::U.show(@args[0], @c)} to not be nil." assert_equal exp, subject.fail_results.first.message end end