-
-
Notifications
You must be signed in to change notification settings - Fork 52
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 describe_on_supported_os DSL #132
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -185,6 +185,23 @@ describe 'myclass' do | |
end | ||
``` | ||
|
||
```ruby | ||
require 'spec_helper' | ||
|
||
describe_on_supported_os 'myclass' do | ||
it { is_expected.to compile.with_all_deps } | ||
... | ||
|
||
# If you need any to specify any operating system specific tests | ||
case metadata[:os_facts][:osfamily] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The current setup only symbolizes part of the data used in blocks like this. How would one expanded to use non-legacy facts look? It looks like this today, for context: case os_facts[:os]['family']
when 'RedHat'
...
when 'Debian'
...
else
...
end There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Again, really unrelated but yes, it's really confusing that it's not fully using symbols. The root cause is here. Ideally speaking it would use something like HashWithIndifferentAccess but pulling in ActiveSupport just for that feels very heavy. However, facts from FacterDB should really be read-only besides overrides. We can probably easily subclass |
||
when 'Debian' | ||
... | ||
else | ||
... | ||
end | ||
end | ||
``` | ||
|
||
When using roles and profiles to manage a heterogeneous IT estate, you can test a profile that supports several OSes with many `let(:facts)` as long as each is in its own context: | ||
```ruby | ||
require 'spec_helper' | ||
|
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.
I added the example here just so you could easily compare it to the block above it.