-
Notifications
You must be signed in to change notification settings - Fork 56
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
(FM-8355) Add spec_helper_acceptance #210
(FM-8355) Add spec_helper_acceptance #210
Conversation
Codecov Report
@@ Coverage Diff @@
## master #210 +/- ##
==========================================
- Coverage 59.73% 59.62% -0.12%
==========================================
Files 6 6
Lines 534 535 +1
==========================================
Hits 319 319
- Misses 215 216 +1
Continue to review full report at Codecov.
|
bab4b65
to
ed85c54
Compare
Related issue: #48 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you wrap all of this in a module function (e.g.PuppetLitmus.configure!
) then you could write some unit tests around its behavior. Further, you could make the method take an options hash or yield a configuration object to a block to allow for more explicit customization, even if the defaults continue to look up things from the ENV
and node config files.
Usage in spec_helper_acceptance.rb
then looks like:
require 'puppet_litmus'
PuppetLitmus.configure!
or even:
begin
require 'puppet_litmus'
PuppetLitmus.configure!
rescue LoadError
puts 'Unable to load Litmus, did you add it to your Gemfile?'
end
We would still need to do |
ed85c54
to
a7fe674
Compare
Updated code works with require 'puppet_litmus'
include PuppetLitmus
PuppetLitmus.configure! |
Looks like there's a merge conflict so a rebase is needed. |
45fdbd4
to
8d786d7
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking at https://github.com/puppetlabs/puppetlabs_spec_helper/blob/master/lib/puppetlabs_spec_helper/puppetlabs_spec_helper.rb you can use RSpec.configure
and call .extend
or .include
. That looks like a much cleaner solution.
b630aab
to
b508a1f
Compare
b508a1f
to
1b17df0
Compare
With the last upgrade the |
yep, just tested require 'puppet_litmus'
PuppetLitmus.configure! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! I think this is a much cleaner way.
Currently the wiki documents how to integrate but I wonder if this is now simple enough to just include in README.md. https://github.com/puppetlabs/puppetlabs_spec_helper#usage is IMHO a great example to get started quickly and saves a click. IMHO README.md is also better because it's in the repo and thus versioned.
This way, we just need to
require 'litmus_spec_helper_acceptance'
in the spec_helper_acceptance of every module