Sha256: f199287d1efb010f6c3e73db12002fad515125171de57ed605e1793e731bf0ef

Contents?: true

Size: 1.1 KB

Versions: 3

Compression:

Stored size: 1.1 KB

Contents

require_relative '../test_helper'
require_relative '../helpers/constant_overrides'

class UtilsTest < Minitest::Test
  include ConstantOverrides

  context "global namespace issues" do
    setup do
      setup_constant_overrides
    end

    teardown do
      cleanup_constant_overrides
    end

    should "define Diff as Invoca::Utils::Diff" do
      assert_equal ::Diff, Invoca::Utils::Diff
    end

    should "define Diffable as Diffable" do
      assert_equal ::Diffable, Invoca::Utils::Diffable
    end

    context "when Diff is defined in the global namespace" do
      setup do
        @class = Class.new
        set_test_const("Diff", @class)
        load 'invoca/utils.rb'
      end

      should "not define Diff as Invoca::Utils::Diff" do
        assert_equal ::Diff, @class
      end
    end

    context "when Diffable is defined in the global namespace" do
      setup do
        @class = Class.new
        set_test_const("Diffable", @class)
        load 'invoca/utils.rb'
      end

      should "define Diffable as Invoca::Utils::Diffable" do
        assert_equal ::Diffable, @class
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
invoca-utils-0.1.0.pre.2 test/unit/utils_test.rb
invoca-utils-0.0.5 test/unit/utils_test.rb
invoca-utils-0.0.4 test/unit/utils_test.rb