Sha256: 18cd29c95e5f4cf0520c4b505d0e1a7ae53bb20e0a3015068e9490f9ceed8b9a

Contents?: true

Size: 1.68 KB

Versions: 1

Compression:

Stored size: 1.68 KB

Contents

require 'assert'
require 'assert/suite'
require 'assert/view/base'
require 'stringio'

class Assert::View::Base

  class UnitTests < Assert::Context
    desc "Assert::View::Base"
    setup do
      @io = StringIO.new("", "w+")
      @config = Factory.modes_off_config
      @view = Assert::View::Base.new(@io, @config, @config.suite)
    end
    subject{ @view }

    # accessors, base methods
    should have_imeths :is_tty?, :view, :config, :suite, :fire
    should have_imeths :before_load, :after_load, :on_start, :on_finish
    should have_imeths :before_test, :after_test, :on_result

    # common methods
    should have_imeths :runner_seed, :count, :tests?, :all_pass?
    should have_imeths :run_time, :test_rate, :result_rate
    should have_imeths :suite_contexts, :ordered_suite_contexts
    should have_imeths :suite_files, :ordered_suite_files
    should have_imeths :result_details_for, :show_result_details?
    should have_imeths :ocurring_result_types, :result_summary_msg
    should have_imeths :all_pass_result_summary_msg, :results_summary_sentence
    should have_imeths :test_count_statement, :result_count_statement
    should have_imeths :to_sentence

    should "default its result abbreviations" do
      assert_equal '.', subject.pass_abbrev
      assert_equal 'F', subject.fail_abbrev
      assert_equal 'I', subject.ignore_abbrev
      assert_equal 'S', subject.skip_abbrev
      assert_equal 'E', subject.error_abbrev
    end

    should "know if it is a tty" do
      assert_equal !!@io.isatty, subject.is_tty?
    end

  end

  class HandlerTests < Assert::Context
    desc 'the assert view handler'
    subject { Assert::View }

    should have_instance_method :require_user_view
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
assert-2.5.0 test/unit/view_tests.rb