chefspec-ohai 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/chefspec/ohai.rb +23 -0
- data/lib/chefspec/ohai/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 11e687172fecfd2d53cc1ef2673016f514ec63d9
|
4
|
+
data.tar.gz: 98a404207ad5fd570eef99d05a0d00d574d38ff5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 745621819bab095aff4f0ba16901530cf50aac836b74fb2055af4105dc6eb0bb5f9eb5e0656cc1b79e2f0e59f8799c9a77e01deb702c0eecf20a8a1c0e743d5a
|
7
|
+
data.tar.gz: 9c9ee91f577b6f7d25477a905d2797b83de2a028c838bba3c4da457ed64fc3e828037a203d33b46623b32accdad250190595218e12dafcdbfa73227aabde8e1a
|
data/lib/chefspec/ohai.rb
CHANGED
@@ -57,11 +57,34 @@ Example:
|
|
57
57
|
# evalute the contents as a version 7 ohai plugin.
|
58
58
|
#
|
59
59
|
before :each do
|
60
|
+
capture_named_plugins!
|
60
61
|
ps = plugin_source
|
61
62
|
pp = plugin_path
|
62
63
|
plugin_loader.instance_eval { load_v7_plugin_class(ps,pp) }
|
63
64
|
end
|
64
65
|
|
66
|
+
after :each do
|
67
|
+
restore_named_plugins!
|
68
|
+
end
|
69
|
+
|
70
|
+
|
71
|
+
# Ohai plugins are defined with a class, which is a constant, and
|
72
|
+
# they are added to the this module. Capture any currently loaded
|
73
|
+
# plugins before we add any new plugins.
|
74
|
+
def capture_named_plugins!
|
75
|
+
@named_plugins = Ohai::NamedPlugin.constants
|
76
|
+
end
|
77
|
+
|
78
|
+
# Examine the current list of plugins loaded and compare it to
|
79
|
+
# what was found when we started. Remove all the plugins that
|
80
|
+
# have been added since then.
|
81
|
+
def restore_named_plugins!
|
82
|
+
diff_plugins = Ohai::NamedPlugin.constants - @named_plugins
|
83
|
+
diff_plugins.each do |plugin|
|
84
|
+
Ohai::NamedPlugin.send(:remove_const,plugin)
|
85
|
+
end
|
86
|
+
end
|
87
|
+
|
65
88
|
# This provides a new matcher when wanting to make assertions that the plugin
|
66
89
|
# does provide the correct body of attributes. The Ohai plugin class returns
|
67
90
|
# an array of attributes that it provides through `#provides_attrs` which
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: chefspec-ohai
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Franklin Webber
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2017-12-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -79,7 +79,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
79
79
|
version: '0'
|
80
80
|
requirements: []
|
81
81
|
rubyforge_project:
|
82
|
-
rubygems_version: 2.
|
82
|
+
rubygems_version: 2.6.11
|
83
83
|
signing_key:
|
84
84
|
specification_version: 4
|
85
85
|
summary: Provides additional RSpec helpers to test Ohai plugins
|