chefspec-ohai 0.1.0 → 0.1.1

This diff has not been reviewed by any users.
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d64ccf311fb089b7f97897e42e8fdbe9ef0d7e78
4
- data.tar.gz: 2e0dc97593f992fe2306639d4dc92ce972a146d4
3
+ metadata.gz: 11e687172fecfd2d53cc1ef2673016f514ec63d9
4
+ data.tar.gz: 98a404207ad5fd570eef99d05a0d00d574d38ff5
5
5
  SHA512:
6
- metadata.gz: be73a60edb56cc7349b9b1269a2f9ff69373e82a06b59bb5f6faa39a28462341eedfa1533fb98732561877aafddd288c44dc76d41fb404db3cc515b1822d3696
7
- data.tar.gz: 0ea98d27be390b8b9f443d5cc20db71a365ef31f42eba2d0e2f11725b4e9d5b53182cf62c9a0b1ea1684d80a778471c86301e765844f1bacf80e2d0858577646
6
+ metadata.gz: 745621819bab095aff4f0ba16901530cf50aac836b74fb2055af4105dc6eb0bb5f9eb5e0656cc1b79e2f0e59f8799c9a77e01deb702c0eecf20a8a1c0e743d5a
7
+ data.tar.gz: 9c9ee91f577b6f7d25477a905d2797b83de2a028c838bba3c4da457ed64fc3e828037a203d33b46623b32accdad250190595218e12dafcdbfa73227aabde8e1a
@@ -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
@@ -1,5 +1,5 @@
1
1
  module Chefspec
2
2
  module Ohai
3
- VERSION = "0.1.0"
3
+ VERSION = "0.1.1"
4
4
  end
5
5
  end
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.0
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: 2016-10-04 00:00:00.000000000 Z
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.2.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