Sha256: 61c6c3256f8201821046c520ffca0bff28e83c12688b0d9357eb608e3ccd1cde

Contents?: true

Size: 1.58 KB

Versions: 21

Compression:

Stored size: 1.58 KB

Contents

# frozen_string_literal: true
require File.dirname(__FILE__) + '/spec_helper'

RSpec.describe "YARD::Handlers::Ruby::#{LEGACY_PARSER ? "Legacy::" : ""}VisibilityHandler" do
  before(:all) { parse_file :visibility_handler_001, __FILE__ }

  it "is able to set visibility to public" do
    expect(Registry.at("Testing#pub").visibility).to eq :public
    expect(Registry.at("Testing#pub2").visibility).to eq :public
  end

  it "is able to set visibility to private" do
    expect(Registry.at("Testing#priv").visibility).to eq :private
  end

  it "is able to set visibility to protected" do
    expect(Registry.at("Testing#prot").visibility).to eq :protected
  end

  it "supports parameters and only set visibility on those methods" do
    expect(Registry.at('Testing#notpriv').visibility).to eq :protected
    expect(Registry.at('Testing#notpriv2').visibility).to eq :protected
    expect(Registry.at('Testing#notpriv?').visibility).to eq :protected
  end

  it "only accepts strings and symbols" do
    expect(Registry.at('Testing#name')).to be nil
    expect(Registry.at('Testing#argument')).to be nil
    expect(Registry.at('Testing#method_call')).to be nil
  end

  it "handles constants passed in as symbols" do
    expect(Registry.at('Testing#Foo').visibility).to eq :private
  end

  it "does not register classes with visibility" do
    expect(Registry.at('Testing::Bar').visibility).to eq :public
    expect(Registry.at('Testing::Baz').visibility).to eq :public
  end

  it "can decorate a method definition" do
    expect(Registry.at('Testing#decpriv').visibility).to eq :private
  end unless LEGACY_PARSER
end

Version data entries

21 entries across 20 versions & 4 rubygems

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