Sha256: 6344879b523b152bf5be99a6629406242f24194d7fc4ce4a896130ac86821121

Contents?: true

Size: 1 KB

Versions: 7

Compression:

Stored size: 1 KB

Contents

require File.dirname(__FILE__) + "/../spec_helper"

describe YARD::Templates::Helpers::ModuleHelper do
  include YARD::Templates::Helpers::BaseHelper
  include YARD::Templates::Helpers::ModuleHelper

  describe "#prune_method_listing" do
    before { YARD::Registry.clear }
    let(:options) { OpenStruct.new }
    let(:object) { YARD::Registry.at("Foo#bar") }
    let(:objects) { [object] }

    it "filters aliases" do
      YARD.parse_string "class Foo; def orig; end; alias bar orig end"
      expect(prune_method_listing(objects)).to eq []
    end

    it "filters attributes" do
      YARD.parse_string "class Foo; attr_accessor :bar end"
      expect(prune_method_listing(objects)).to eq []
    end

    it "ignores methods if namespace object is filtered" do
      YARD.parse_string <<-eof
        # @author test
        class Foo
          def bar; end
        end
      eof

      options.verifier = YARD::Verifier.new('@author.text != "test"')
      expect(prune_method_listing(objects)).to eq []
    end
  end
end

Version data entries

7 entries across 6 versions & 2 rubygems

Version Path
abaci-0.3.0 vendor/bundle/gems/yard-0.9.2/spec/templates/helpers/module_helper_spec.rb
abaci-0.3.0 vendor/bundle/gems/yard-0.9.1/spec/templates/helpers/module_helper_spec.rb
yard-0.9.5 spec/templates/helpers/module_helper_spec.rb
yard-0.9.4 spec/templates/helpers/module_helper_spec.rb
yard-0.9.3 spec/templates/helpers/module_helper_spec.rb
yard-0.9.2 spec/templates/helpers/module_helper_spec.rb
yard-0.9.1 spec/templates/helpers/module_helper_spec.rb