Sha256: aaf84f024f0e6c4e517f7948914117e98b8824c501a160fbcce65af11a9fc42f

Contents?: true

Size: 656 Bytes

Versions: 5

Compression:

Stored size: 656 Bytes

Contents

describe Class do
  before do
    module Aaa
      module Bbb
        module Ccc
          class  Ddd; end
          module Eee; end
        end
      end
    end
  end

  context "in_namespace?" do
    it "Class in Module" do
      expect(Aaa::Bbb::Ccc::Ddd.in_namespace?(Aaa::Bbb)).to be_truthy
    end

    it "Module in Module" do
      expect(Aaa::Bbb::Ccc::Eee.in_namespace?("Aaa::Bbb")).to be_truthy
    end

    it "Instance of Class" do
      expect(Aaa::Bbb::Ccc::Ddd.new.in_namespace?(Aaa::Bbb)).to be_truthy
    end

    it "Not in namespace" do
      expect(Aaa::Bbb::Ccc::Eee.in_namespace?(Aaa::Bbb::Ccc::Ddd)).to be_falsey
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
more_core_extensions-3.2.0 spec/core_ext/object/namespace_spec.rb
more_core_extensions-3.1.1 spec/core_ext/object/namespace_spec.rb
more_core_extensions-3.1.0 spec/core_ext/object/namespace_spec.rb
more_core_extensions-3.0.0 spec/core_ext/object/namespace_spec.rb
more_core_extensions-2.0.0 spec/core_ext/object/namespace_spec.rb