Sha256: 6ac7d94a3c9d11210097c34348023232d3df2fe3df4dde5a4dd5f80695629fad

Contents?: true

Size: 1.57 KB

Versions: 6

Compression:

Stored size: 1.57 KB

Contents

require "assert/suite"

module Assert
  # This is the default suite used by assert. In addition to the base suite
  # behavior, it accumulates test/result counts in memory.  This data is used
  # by the runner/view for handling and presentation purposes.
  class DefaultSuite < Assert::Suite
    def initialize(config)
      super
      reset_run_data
    end

    def test_count;          @test_count;          end
    def result_count;        @result_count;        end
    def pass_result_count;   @pass_result_count;   end
    def fail_result_count;   @fail_result_count;   end
    def error_result_count;  @error_result_count;  end
    def skip_result_count;   @skip_result_count;   end
    def ignore_result_count; @ignore_result_count; end

    # Callbacks

    def on_start
      reset_run_data
    end

    def before_test(test)
      @test_count += 1
    end

    def on_result(result)
      @result_count += 1
      self.send("increment_#{result.type}_result_count")
    end

    private

    def increment_pass_result_count;   @pass_result_count   += 1; end
    def increment_fail_result_count;   @fail_result_count   += 1; end
    def increment_error_result_count;  @error_result_count  += 1; end
    def increment_skip_result_count;   @skip_result_count   += 1; end
    def increment_ignore_result_count; @ignore_result_count += 1; end

    def reset_run_data
      @test_count          = 0
      @result_count        = 0
      @pass_result_count   = 0
      @fail_result_count   = 0
      @error_result_count  = 0
      @skip_result_count   = 0
      @ignore_result_count = 0
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
assert-2.19.0 lib/assert/default_suite.rb
assert-2.18.4 lib/assert/default_suite.rb
assert-2.18.3 lib/assert/default_suite.rb
assert-2.18.2 lib/assert/default_suite.rb
assert-2.18.1 lib/assert/default_suite.rb
assert-2.18.0 lib/assert/default_suite.rb