Sha256: 03b346df276d54e6e0442b2006a1f819990094f02fb4ad581becf5fe3d71aa8a

Contents?: true

Size: 1011 Bytes

Versions: 21

Compression:

Stored size: 1011 Bytes

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

21 entries across 20 versions & 4 rubygems

Version Path
yard-0.9.24 spec/templates/helpers/module_helper_spec.rb
yard-0.9.23 spec/templates/helpers/module_helper_spec.rb
yard-0.9.22 spec/templates/helpers/module_helper_spec.rb
yard-0.9.21 spec/templates/helpers/module_helper_spec.rb
yard-0.9.20 spec/templates/helpers/module_helper_spec.rb
yard-0.9.19 spec/templates/helpers/module_helper_spec.rb
yard-0.9.16 spec/templates/helpers/module_helper_spec.rb
yard-0.9.15 spec/templates/helpers/module_helper_spec.rb
yard-0.9.14 spec/templates/helpers/module_helper_spec.rb
yard-0.9.13 spec/templates/helpers/module_helper_spec.rb
yard-0.9.12 spec/templates/helpers/module_helper_spec.rb
yard-0.9.11 spec/templates/helpers/module_helper_spec.rb
yard-0.9.10 spec/templates/helpers/module_helper_spec.rb
yard-0.9.9 spec/templates/helpers/module_helper_spec.rb
etude_for_ruby-0.1.4 vendor/bundle/ruby/2.4.0/gems/yard-0.9.8/spec/templates/helpers/module_helper_spec.rb
etude_for_ruby-0.1.4 vendor/bundle/ruby/2.2.0/gems/yard-0.9.8/spec/templates/helpers/module_helper_spec.rb
mdg-1.0.1 vendor/bundle/ruby/2.3.0/gems/yard-0.9.8/spec/templates/helpers/module_helper_spec.rb
yard-0.9.8 spec/templates/helpers/module_helper_spec.rb
abaci-0.3.0 vendor/bundle/gems/yard-0.9.7/spec/templates/helpers/module_helper_spec.rb
yard-0.9.7 spec/templates/helpers/module_helper_spec.rb