Sha256: ed09795de95f2d12e787f5234f4f039dd15d08d1da92276d8cc6090ed1dccd2b
Contents?: true
Size: 1.9 KB
Versions: 2
Compression:
Stored size: 1.9 KB
Contents
require "assert" require "assert/assertions" require "assert/utils" module Assert::Assertions class AssertInstanceOfTests < Assert::Context include Assert::Test::TestHelpers desc "`assert_instance_of`" subject { args = args1 Factory.test do assert_instance_of(String, "object") # pass assert_instance_of(*args) # fail end } let(:desc1) { "assert instance of fail desc" } let(:args1) { [Array, "object", desc1] } let(:config1) { subject.config } should "produce results as expected" do subject.run(&test_run_callback) assert_that(test_run_result_count).equals(2) assert_that(test_run_result_count(:pass)).equals(1) assert_that(test_run_result_count(:fail)).equals(1) exp = "#{args1[2]}\nExpected #{Assert::U.show(args1[1], config1)} (#{args1[1].class})"\ " to be an instance of #{args1[0]}." assert_that(test_run_results(:fail).first.message).equals(exp) end end class AssertNotInstanceOfTests < Assert::Context include Assert::Test::TestHelpers desc "`assert_not_instance_of`" subject { args = args1 Factory.test do assert_not_instance_of(*args) # fail assert_not_instance_of(Array, "object") # pass end } let(:desc1) { "assert not instance of fail desc" } let(:args1) { [String, "object", desc1] } let(:config1) { subject.config } should "produce results as expected" do subject.run(&test_run_callback) assert_that(test_run_result_count).equals(2) assert_that(test_run_result_count(:pass)).equals(1) assert_that(test_run_result_count(:fail)).equals(1) exp = "#{args1[2]}\nExpected #{Assert::U.show(args1[1], config1)} (#{args1[1].class})"\ " to not be an instance of #{args1[0]}." assert_that(test_run_results(:fail).first.message).equals(exp) end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
assert-2.19.0 | test/unit/assertions/assert_instance_of_tests.rb |
assert-2.18.4 | test/unit/assertions/assert_instance_of_tests.rb |