New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use puppetlabs_spec_helper to test parser functions #39
Merged
jeffmccune
merged 1 commit into
rodjek:master
from
jeffmccune:fix/master/clean_function_testing
Aug 15, 2012
Merged
Use puppetlabs_spec_helper to test parser functions #39
jeffmccune
merged 1 commit into
rodjek:master
from
jeffmccune:fix/master/clean_function_testing
Aug 15, 2012
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Without this patch applied rspec-puppet reaches deep inside of Puppet and uses an unsupported and private interface to obtain functions and scope instances. This is a problem because Puppet Labs considers internal classes such as Puppet::Parser::Scope as private and internal. We change these classes without warning and this is a maintenance issue for third party testing tools. This patch fixes this maintenance problem by using the compatibility layer implemented in the puppetlabs_spec_helper. When we change the internal behavior of private classes such as Puppet::Parser::Scope, we'll update the spec helper module methods to provide a version agnostic way to get instances of these internal objects. As an example, a supported way to get a scope instance is: PuppetlabsSpec::PuppetInternals.scope Instead of the private and unsupported method of: Puppet::Parser::Scope.new This patch introduces a Gem dependency onto the puppetlabs_spec_helper gem.
This pull request shouldn't be merged until https://github.com/puppetlabs/puppetlabs_spec_helper/pull/20/files is merged. |
OK, I've released the new Do you mind if I merge this in and release a new version of rspec-puppet ? (Would it be possible to become an owner on rubygems.org?) |
@travisbot test this branch please. |
jeffmccune
pushed a commit
that referenced
this pull request
Aug 15, 2012
Use puppetlabs_spec_helper to test parser functions
blkperl
pushed a commit
to blkperl/puppetlabs_spec_helper
that referenced
this pull request
Jan 25, 2014
Without this patch modules typically get entire scope objects in an effort to invoke parser functions. RSpec::Puppet uses the method instance itself to send the :call message to the method instance. The spec helper does not provide a compatible way to obtain method instances for parser functions. This is a problem because we need a compatible way to test functions that does not incur a high maintenance cost on rspec-puppet. This patch fixes the problem by implementing and compatible way to test functions using their method instances. RSpec::Puppet has been patched in rodjek/rspec-puppet#39 to use this compatibility layer.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This patch supersedes #38
Without this patch applied rspec-puppet reaches deep inside of Puppet
and uses an unsupported and private interface to obtain functions and
scope instances. This is a problem because Puppet Labs considers
internal classes such as Puppet::Parser::Scope as private and internal.
We change these classes without warning and this is a maintenance issue
for third party testing tools.
This patch fixes this maintenance problem by using the compatibility
layer implemented in the puppetlabs_spec_helper. When we change the
internal behavior of private classes such as Puppet::Parser::Scope,
we'll update the spec helper module methods to provide a version
agnostic way to get instances of these internal objects.
As an example, a supported way to get a scope instance is:
PuppetlabsSpec::PuppetInternals.scope
Instead of the private and unsupported method of:
Puppet::Parser::Scope.new
This patch introduces a Gem dependency onto the puppetlabs_spec_helper
gem.