Sha256: f98e84aec6b64381c824672222673862ad18a27579c4e822eea529c8cad8bc11

Contents?: true

Size: 1.02 KB

Versions: 2

Compression:

Stored size: 1.02 KB

Contents

# frozen_string_literal: true

RSpec.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

2 entries across 2 versions & 1 rubygems

Version Path
yard-0.9.18 spec/templates/helpers/module_helper_spec.rb
yard-0.9.17 spec/templates/helpers/module_helper_spec.rb