Sha256: babb0afcdf38cccaf3e247c1747fe0f87f640ff2dd1dc569b07de92a544ef3ca

Contents?: true

Size: 1.13 KB

Versions: 7

Compression:

Stored size: 1.13 KB

Contents

# frozen_string_literal: true

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

7 entries across 7 versions & 1 rubygems

Version Path
invoca-utils-0.4.1 test/unit/utils_test.rb
invoca-utils-0.4.0 test/unit/utils_test.rb
invoca-utils-0.3.0 test/unit/utils_test.rb
invoca-utils-0.2.0 test/unit/utils_test.rb
invoca-utils-0.2.0.pre.1 test/unit/utils_test.rb
invoca-utils-0.1.1 test/unit/utils_test.rb
invoca-utils-0.1.0 test/unit/utils_test.rb