Skip to content
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

Add a way to mock a Puppet/Bolt function while testing a plan with BoltSpec #3295

Open
jay7x opened this issue Apr 4, 2024 · 2 comments
Open
Labels
Feature New features and improvements.

Comments

@jay7x
Copy link
Contributor

jay7x commented Apr 4, 2024

Use Case

It'd be nice to mock a Puppet DSL function or a Puppet v4 Ruby API function while testing a plan with BoltSpec.

Describe the Solution You Would Like

Ideally it should be as clean as possible:

allow(<some Puppet object>).to receive(:function_name_to_mock).with(args).and_return(fake_result)

When testing a Puppet class/defined resource it's possible to workaround the issue with pre_condition.. but in BoltSpec I see no way to do this..

Describe Alternatives You've Considered

I can wrap a function call with a plan but it's too weird IMHO..

@jay7x jay7x added the Feature New features and improvements. label Apr 4, 2024
@donoghuc
Copy link
Contributor

donoghuc commented Apr 4, 2024

Thanks this has been requested before. #1812

@jay7x
Copy link
Contributor Author

jay7x commented Apr 4, 2024

Ouch.. maybe better to reopen that one and close this then..

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature New features and improvements.
Projects
None yet
Development

No branches or pull requests

2 participants