Sha256: 234a46e59e1d15bf5d12be132ba1a6f556c6cb8a9de0ec3e056170c87dcb6f3c

Contents?: true

Size: 1.65 KB

Versions: 8

Compression:

Stored size: 1.65 KB

Contents

require File.expand_path(File.dirname(__FILE__) + '/../../test_helper')

describe ::Inch::API::Filter do
  before do
    @dir = fixture_path(:simple)
    @codebase = ::Inch::Codebase.parse(@dir)
  end

  it "should work" do
    @options = {}
    @context = ::Inch::API::Filter.new @codebase, @options
    refute @context.objects.empty?
    refute @context.grade_lists.empty?
  end

  it "should work with option: visibility == :public" do
    @options = {:visibility => [:public]}
    @context = ::Inch::API::Filter.new @codebase, @options
    assert @context.objects.all? { |o| o.public? }
  end

  it "should work with option: visibility == :protected" do
    @options = {:visibility => [:protected]}
    @context = ::Inch::API::Filter.new @codebase, @options
    assert @context.objects.all? { |o| o.protected? }
  end

  it "should work with option: visibility == :private" do
    @options = {:visibility => [:private]}
    @context = ::Inch::API::Filter.new @codebase, @options
    assert @context.objects.all? { |o| o.private? || o.private_tag? }
  end

  it "should work with option: namespaces == :only" do
    @options = {:namespaces => :only}
    @context = ::Inch::API::Filter.new @codebase, @options
    assert @context.objects.all? { |o| o.namespace? }
  end

  it "should work with option: undocumented == :only" do
    @options = {:undocumented => :only}
    @context = ::Inch::API::Filter.new @codebase, @options
    assert @context.objects.all? { |o| o.undocumented? }
  end

  it "should work with option: depth == 2" do
    @options = {:depth => 2}
    @context = ::Inch::API::Filter.new @codebase, @options
    refute @context.objects.any? { |o| o.depth > 2 }
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
inch-0.3.1.rc4 test/inch/api/filter_test.rb
inch-0.3.1.rc3 test/inch/api/filter_test.rb
inch-0.3.1.rc2 test/inch/api/filter_test.rb
inch-0.3.1.rc1 test/inch/api/filter_test.rb
inch-0.3.0 test/inch/api/filter_test.rb
inch-0.3.0.rc3 test/inch/api/filter_test.rb
inch-0.3.0.rc2 test/inch/api/filter_test.rb
inch-0.3.0.rc1 test/inch/api/filter_test.rb