Sha256: 5e32563fe7955fb2d48bab06af04d55d46ed81f3656b2dae10d5e07f05ba327f

Contents?: true

Size: 1.22 KB

Versions: 5

Compression:

Stored size: 1.22 KB

Contents

require 'spec_helper'

describe Looksee::ObjectMixin do
  describe "#ls" do
    before do
      @object = Object.new
      Looksee.stub(:default_specifiers).and_return([:public, :overridden])
    end

    it "should return an Inspector for the object's lookup path" do
      result = @object.ls
      result.should be_a(Looksee::Inspector)
      result.lookup_path.object.should.equal?(@object)
    end

    it "should use Looksee.default_specifiers if no args are given" do
      @object.ls.visibilities.should == Set[:public, :overridden]
    end

    it "should set visibilities from the given symbols" do
      inspector = @object.ls(:private)
      inspector.visibilities.should == Set[:public, :overridden, :private]
    end

    it "should unset visibilities from the given 'no' symbols" do
      inspector = @object.ls(:nooverridden)
      inspector.visibilities.should == Set[:public]
    end

    it "should set filters from the given strings and regexp" do
      inspector = @object.ls('aa', /bb/)
      inspector.filters.should == Set['aa', /bb/]
    end

    it "should raise an ArgumentError if an invalid argument is given" do
      lambda do
        @object.ls(Object.new)
      end.should raise_error(ArgumentError)
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
looksee-2.0.0-universal-java-1.6 spec/core_ext_spec.rb
looksee-2.0.0 spec/core_ext_spec.rb
looksee-1.1.0 spec/core_ext_spec.rb
looksee-1.0.3-universal-java-1.6 spec/core_ext_spec.rb
looksee-1.0.3 spec/core_ext_spec.rb