(PDOC-3) Make references to YARD explicit
The specs were including YARD into the Kernel, which allowed shorter references to the Registry, but also obscured that the Registry is part of YARD.
This commit is contained in:
parent
5159a7b778
commit
14571c098d
|
@ -1,7 +1,7 @@
|
||||||
require 'puppet'
|
require 'puppet'
|
||||||
require 'puppetx/puppetlabs/strings/yard/monkey_patches'
|
require 'puppetx/puppetlabs/strings/yard/monkey_patches'
|
||||||
require 'puppetx/puppetlabs/strings/yard/parser'
|
require 'puppetx/puppetlabs/strings/yard/parser'
|
||||||
require 'puppetx/puppetlabs/strings/yard/handlers'
|
require 'puppetx/puppetlabs/strings'
|
||||||
|
|
||||||
YARD::Parser::SourceParser.register_parser_type(:puppet,
|
YARD::Parser::SourceParser.register_parser_type(:puppet,
|
||||||
Puppetx::PuppetLabs::Strings::YARD::PuppetParser,
|
Puppetx::PuppetLabs::Strings::YARD::PuppetParser,
|
||||||
|
|
|
@ -6,7 +6,7 @@ module StringsSpec
|
||||||
# Cleans up the Registry and gives YARD some source code
|
# Cleans up the Registry and gives YARD some source code
|
||||||
# to generate documentation for
|
# to generate documentation for
|
||||||
def parse(string, parser = :ruby)
|
def parse(string, parser = :ruby)
|
||||||
Registry.clear
|
YARD::Registry.clear
|
||||||
YARD::Parser::SourceParser.parse_string(string, parser)
|
YARD::Parser::SourceParser.parse_string(string, parser)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -5,9 +5,7 @@ require 'mocha'
|
||||||
require 'puppet'
|
require 'puppet'
|
||||||
require 'rspec'
|
require 'rspec'
|
||||||
|
|
||||||
# This is neeeded so we can access a Registry if YARD creates one
|
require 'puppetx/puppetlabs/strings'
|
||||||
require 'puppetx/puppetlabs/strings/yard/plugin'
|
|
||||||
include YARD
|
|
||||||
|
|
||||||
RSpec.configure do |config|
|
RSpec.configure do |config|
|
||||||
config.mock_with :mocha
|
config.mock_with :mocha
|
||||||
|
|
|
@ -7,7 +7,7 @@ describe Puppetx::PuppetLabs::Strings::YARD::Handlers::DefinedTypeHandler do
|
||||||
include StringsSpec::Parsing
|
include StringsSpec::Parsing
|
||||||
|
|
||||||
def the_definedtype()
|
def the_definedtype()
|
||||||
Registry.at("foo::bar")
|
YARD::Registry.at("foo::bar")
|
||||||
end
|
end
|
||||||
|
|
||||||
it "should parse single-line documentation strings before a given defined type" do
|
it "should parse single-line documentation strings before a given defined type" do
|
||||||
|
@ -56,6 +56,6 @@ describe Puppetx::PuppetLabs::Strings::YARD::Handlers::DefinedTypeHandler do
|
||||||
|
|
||||||
parse(puppet_code, :puppet)
|
parse(puppet_code, :puppet)
|
||||||
|
|
||||||
expect(Registry.all).to be_empty
|
expect(YARD::Registry.all).to be_empty
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -6,7 +6,7 @@ describe Puppetx::PuppetLabs::Strings::YARD::Handlers::HostClassHandler do
|
||||||
include StringsSpec::Parsing
|
include StringsSpec::Parsing
|
||||||
|
|
||||||
def the_hostclass()
|
def the_hostclass()
|
||||||
Registry.at("foo::bar")
|
YARD::Registry.at("foo::bar")
|
||||||
end
|
end
|
||||||
|
|
||||||
it "should parse single-line documentation strings before a given class" do
|
it "should parse single-line documentation strings before a given class" do
|
||||||
|
|
|
@ -6,11 +6,11 @@ describe Puppetx::PuppetLabs::Strings::YARD::Handlers::Puppet3xFunctionHandler d
|
||||||
include StringsSpec::Parsing
|
include StringsSpec::Parsing
|
||||||
|
|
||||||
def the_method()
|
def the_method()
|
||||||
Registry.at("Puppet3xFunctions#the_function")
|
YARD::Registry.at("Puppet3xFunctions#the_function")
|
||||||
end
|
end
|
||||||
|
|
||||||
def the_namespace()
|
def the_namespace()
|
||||||
Registry.at("Puppet3xFunctions")
|
YARD::Registry.at("Puppet3xFunctions")
|
||||||
end
|
end
|
||||||
|
|
||||||
it "should parse single-line documentation strings before a given function" do
|
it "should parse single-line documentation strings before a given function" do
|
||||||
|
|
|
@ -6,11 +6,11 @@ describe Puppetx::PuppetLabs::Strings::YARD::Handlers::Puppet4xFunctionHandler d
|
||||||
include StringsSpec::Parsing
|
include StringsSpec::Parsing
|
||||||
|
|
||||||
def the_method()
|
def the_method()
|
||||||
Registry.at("Puppet4xFunctions#the_function")
|
YARD::Registry.at("Puppet4xFunctions#the_function")
|
||||||
end
|
end
|
||||||
|
|
||||||
def the_namespace()
|
def the_namespace()
|
||||||
Registry.at("Puppet4xFunctions")
|
YARD::Registry.at("Puppet4xFunctions")
|
||||||
end
|
end
|
||||||
|
|
||||||
it "should parse single-line documentation strings before a given function" do
|
it "should parse single-line documentation strings before a given function" do
|
||||||
|
@ -60,6 +60,6 @@ describe Puppetx::PuppetLabs::Strings::YARD::Handlers::Puppet4xFunctionHandler d
|
||||||
This is not ruby code
|
This is not ruby code
|
||||||
RUBY
|
RUBY
|
||||||
|
|
||||||
expect(Registry.all).to be_empty
|
expect(YARD::Registry.all).to be_empty
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue