Sha256: 1e0e7483bf22b45812e32998627656f73a7e316aab5783b190022bc66e981994

Contents?: true

Size: 1.23 KB

Versions: 15

Compression:

Stored size: 1.23 KB

Contents

require 'spec_helper'

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

    it "should return an Inspector for the object's lookup path" do
      result = Looksee[@object]
      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
      Looksee[@object].visibilities.should == Set[:public, :overridden]
    end

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

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

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

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

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
looksee-5.0.0 spec/looksee/clean_spec.rb
looksee-4.4.0 spec/looksee/clean_spec.rb
looksee-4.2.0 spec/looksee/clean_spec.rb
looksee-4.1.0 spec/looksee/clean_spec.rb
looksee-4.0.0-universal-java-1.8 spec/looksee/clean_spec.rb
looksee-4.0.0 spec/looksee/clean_spec.rb
looksee-3.1.1 spec/looksee/clean_spec.rb
looksee-3.1.0-universal-java-1.8 spec/looksee/clean_spec.rb
looksee-3.1.0 spec/looksee/clean_spec.rb
looksee-3.0.1-universal-java-1.8 spec/looksee/clean_spec.rb
looksee-3.0.1 spec/looksee/clean_spec.rb
looksee-3.0.0-universal-java-1.8 spec/looksee/clean_spec.rb
looksee-3.0.0 spec/looksee/clean_spec.rb
looksee-2.1.1-universal-java-1.6 spec/looksee/clean_spec.rb
looksee-2.1.1 spec/looksee/clean_spec.rb