test/unit/test_tests.rb in assert-2.12.2 vs test/unit/test_tests.rb in assert-2.13.0

- old
+ new

@@ -1,9 +1,10 @@ require 'assert' require 'assert/test' require 'assert/config' +require 'assert/file_line' class Assert::Test class UnitTests < Assert::Context desc "Assert::Test" @@ -13,26 +14,34 @@ @context_info = Factory.context_info(@context_class) @test = Factory.test("should do something amazing", @context_info, :code => @test_code) end subject{ @test } - should have_readers :name, :context_info, :config, :code + should have_readers :context_info, :config + should have_readers :name, :file_line, :code should have_accessors :results, :output, :run_time - should have_imeths :run, :result_count, :result_rate, :context_class + should have_imeths :context_class, :file, :line_number + should have_imeths :run, :result_count, :result_rate should have_imeths *Assert::Result.types.keys.collect{ |k| "#{k}_results" } - should "build its name from the context description" do - exp_name = "context class should do something amazing" - assert_equal exp_name, subject.name - end - - should "know it's context class" do + should "know its context class" do assert_equal @context_class, subject.context_class end should "know its config" do cust_config = Assert::Config.new assert_equal cust_config, Factory.test(cust_config).config + end + + should "know its name, file line, file and number" do + exp = "context class should do something amazing" + assert_equal exp, subject.name + + exp = Assert::FileLine.new(*@context_info.called_from.split(':')) + assert_equal exp, subject.file_line + + assert_equal subject.file_line.file, subject.file + assert_equal subject.file_line.line, subject.line_number end should "get its code from any passed opt, falling back on any given block" do assert_equal @test_code, subject.code