Sha256: 50438c838c141a16ac6d2ef262184f2999b8f49ae316cdc92db4a82c11fb1bfc

Contents?: true

Size: 1.8 KB

Versions: 6

Compression:

Stored size: 1.8 KB

Contents

require 'assert'
require 'assert/view'

require 'stringio'
require 'assert/config_helpers'
require 'assert/suite'
require 'assert/view_helpers'

class Assert::View

  class UnitTests < Assert::Context
    desc "Assert::View"
    subject { Assert::View }

    should have_instance_method :require_user_view

    should "include the config helpers" do
      assert_includes Assert::ConfigHelpers, subject
    end

    should "include the view helpers" do
      assert_includes Assert::ViewHelpers, subject
    end

  end

  class InitTests < UnitTests
    desc "when init"
    setup do
      @io     = StringIO.new("", "w+")
      @config = Factory.modes_off_config

      @view = Assert::View.new(@config, @io)
    end
    subject{ @view }

    should have_readers :config
    should have_imeths :view, :is_tty?
    should have_imeths :before_load, :after_load
    should have_imeths :on_start, :on_finish, :on_interrupt
    should have_imeths :before_test, :after_test, :on_result

    should "default its style options" do
      assert_false subject.styled

      assert_nil subject.pass_styles
      assert_nil subject.fail_styles
      assert_nil subject.error_styles
      assert_nil subject.skip_styles
      assert_nil subject.ignore_styles
    end

    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 its config" do
      assert_equal @config, subject.config
    end

    should "override the config helper's view value with itself" do
      assert_equal subject, subject.view
    end

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

  end

end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
assert-2.16.3 test/unit/view_tests.rb
assert-2.16.2 test/unit/view_tests.rb
assert-2.16.1 test/unit/view_tests.rb
assert-2.16.0 test/unit/view_tests.rb
assert-2.15.2 test/unit/view_tests.rb
assert-2.15.1 test/unit/view_tests.rb