chefspec 9.1.0 → 9.3.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (95) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +16 -9
  3. data/Rakefile +60 -52
  4. data/chefspec.gemspec +20 -20
  5. data/lib/chefspec/api/core.rb +3 -3
  6. data/lib/chefspec/api/described.rb +3 -5
  7. data/lib/chefspec/api/stubs.rb +2 -2
  8. data/lib/chefspec/api/stubs_for.rb +22 -19
  9. data/lib/chefspec/api.rb +14 -14
  10. data/lib/chefspec/berkshelf.rb +4 -4
  11. data/lib/chefspec/cacher.rb +2 -2
  12. data/lib/chefspec/coverage/filters.rb +18 -15
  13. data/lib/chefspec/coverage.rb +35 -40
  14. data/lib/chefspec/deprecations.rb +3 -3
  15. data/lib/chefspec/errors.rb +7 -7
  16. data/lib/chefspec/expect_exception.rb +2 -1
  17. data/lib/chefspec/extensions/chef/client.rb +3 -3
  18. data/lib/chefspec/extensions/chef/conditional.rb +2 -1
  19. data/lib/chefspec/extensions/chef/cookbook/gem_installer.rb +5 -4
  20. data/lib/chefspec/extensions/chef/cookbook_loader.rb +1 -0
  21. data/lib/chefspec/extensions/chef/cookbook_uploader.rb +1 -1
  22. data/lib/chefspec/extensions/chef/data_query.rb +3 -3
  23. data/lib/chefspec/extensions/chef/lwrp_base.rb +1 -0
  24. data/lib/chefspec/extensions/chef/provider.rb +8 -5
  25. data/lib/chefspec/extensions/chef/resource/freebsd_package.rb +2 -1
  26. data/lib/chefspec/extensions/chef/resource.rb +18 -12
  27. data/lib/chefspec/extensions/chef/run_context/cookbook_compiler.rb +21 -1
  28. data/lib/chefspec/extensions/chef/securable.rb +1 -1
  29. data/lib/chefspec/extensions/ohai/system.rb +11 -0
  30. data/lib/chefspec/extensions.rb +14 -13
  31. data/lib/chefspec/file_cache_path_proxy.rb +3 -3
  32. data/lib/chefspec/formatter.rb +15 -3
  33. data/lib/chefspec/librarian.rb +7 -6
  34. data/lib/chefspec/matchers/do_nothing_matcher.rb +15 -15
  35. data/lib/chefspec/matchers/include_any_recipe_matcher.rb +4 -4
  36. data/lib/chefspec/matchers/include_recipe_matcher.rb +1 -1
  37. data/lib/chefspec/matchers/link_to_matcher.rb +2 -2
  38. data/lib/chefspec/matchers/notifications_matcher.rb +5 -4
  39. data/lib/chefspec/matchers/render_file_matcher.rb +3 -3
  40. data/lib/chefspec/matchers/resource_matcher.rb +18 -16
  41. data/lib/chefspec/matchers.rb +9 -9
  42. data/lib/chefspec/mixins/normalize.rb +1 -1
  43. data/lib/chefspec/policyfile.rb +6 -6
  44. data/lib/chefspec/renderer.rb +4 -4
  45. data/lib/chefspec/rspec.rb +1 -1
  46. data/lib/chefspec/server.rb +1 -1
  47. data/lib/chefspec/server_methods.rb +8 -8
  48. data/lib/chefspec/server_runner.rb +10 -10
  49. data/lib/chefspec/solo_runner.rb +27 -25
  50. data/lib/chefspec/stubs/command_registry.rb +1 -1
  51. data/lib/chefspec/stubs/command_stub.rb +1 -1
  52. data/lib/chefspec/stubs/data_bag_item_registry.rb +1 -1
  53. data/lib/chefspec/stubs/data_bag_item_stub.rb +1 -1
  54. data/lib/chefspec/stubs/data_bag_registry.rb +1 -1
  55. data/lib/chefspec/stubs/data_bag_stub.rb +1 -1
  56. data/lib/chefspec/stubs/registry.rb +1 -1
  57. data/lib/chefspec/stubs/search_registry.rb +2 -2
  58. data/lib/chefspec/stubs/search_stub.rb +2 -2
  59. data/lib/chefspec/util.rb +7 -7
  60. data/lib/chefspec/version.rb +1 -1
  61. data/lib/chefspec/zero_server.rb +4 -4
  62. data/lib/chefspec.rb +29 -29
  63. data/spec/spec_helper.rb +3 -4
  64. data/spec/support/hash.rb +3 -3
  65. data/spec/unit/cacher_spec.rb +17 -17
  66. data/spec/unit/coverage/filters_spec.rb +16 -16
  67. data/spec/unit/deprecations_spec.rb +8 -9
  68. data/spec/unit/errors_spec.rb +15 -15
  69. data/spec/unit/expect_exception_spec.rb +9 -9
  70. data/spec/unit/macros_spec.rb +50 -50
  71. data/spec/unit/matchers/do_nothing_matcher.rb +1 -1
  72. data/spec/unit/matchers/include_any_recipe_matcher_spec.rb +23 -23
  73. data/spec/unit/matchers/include_recipe_matcher_spec.rb +15 -15
  74. data/spec/unit/matchers/link_to_matcher_spec.rb +18 -18
  75. data/spec/unit/matchers/notifications_matcher_spec.rb +15 -16
  76. data/spec/unit/matchers/render_file_matcher_spec.rb +26 -26
  77. data/spec/unit/matchers/resource_matcher_spec.rb +1 -1
  78. data/spec/unit/matchers/state_attrs_matcher_spec.rb +24 -24
  79. data/spec/unit/matchers/subscribes_matcher_spec.rb +27 -29
  80. data/spec/unit/renderer_spec.rb +36 -36
  81. data/spec/unit/server_runner_spec.rb +6 -6
  82. data/spec/unit/solo_runner_spec.rb +69 -69
  83. data/spec/unit/stubs/command_registry_spec.rb +11 -11
  84. data/spec/unit/stubs/command_stub_spec.rb +26 -26
  85. data/spec/unit/stubs/data_bag_item_registry_spec.rb +17 -17
  86. data/spec/unit/stubs/data_bag_item_stub_spec.rb +14 -14
  87. data/spec/unit/stubs/data_bag_registry_spec.rb +16 -16
  88. data/spec/unit/stubs/data_bag_stub_spec.rb +13 -13
  89. data/spec/unit/stubs/registry_spec.rb +9 -9
  90. data/spec/unit/stubs/search_registry_spec.rb +17 -17
  91. data/spec/unit/stubs/search_stub_spec.rb +14 -14
  92. data/spec/unit/stubs/stub_spec.rb +22 -22
  93. metadata +10 -11
  94. data/lib/chefspec/extensions/.DS_Store +0 -0
  95. data/lib/chefspec/extensions/chef/.DS_Store +0 -0
@@ -1,4 +1,4 @@
1
- require 'chef/run_context/cookbook_compiler'
1
+ require "chef/run_context/cookbook_compiler"
2
2
 
3
3
  Chef::RunContext::CookbookCompiler.prepend(Module.new do
4
4
  # List of compile phases as of Chef 14:
@@ -15,27 +15,44 @@ Chef::RunContext::CookbookCompiler.prepend(Module.new do
15
15
 
16
16
  def load_libraries_from_cookbook(cookbook)
17
17
  return super unless $CHEFSPEC_MODE
18
+
18
19
  $CHEFSPEC_LIBRARY_PRELOAD ||= {}
19
20
  # Already loaded this once.
20
21
  return if $CHEFSPEC_LIBRARY_PRELOAD[cookbook]
22
+
21
23
  $CHEFSPEC_LIBRARY_PRELOAD[cookbook] = true
22
24
  super
23
25
  end
24
26
 
27
+ def load_ohai_plugins_from_cookbook(cookbook)
28
+ return super unless $CHEFSPEC_MODE
29
+
30
+ $CHEFSPEC_OHAI_PRELOAD ||= {}
31
+ # Already loaded this once.
32
+ return if $CHEFSPEC_OHAI_PRELOAD[cookbook]
33
+
34
+ $CHEFSPEC_OHAI_PRELOAD[cookbook] = true
35
+ super
36
+ end
37
+
25
38
  def load_lwrps_from_cookbook(cookbook)
26
39
  return super unless $CHEFSPEC_MODE
40
+
27
41
  $CHEFSPEC_LWRP_PRELOAD ||= {}
28
42
  # Already loaded this once.
29
43
  return if $CHEFSPEC_LWRP_PRELOAD[cookbook]
44
+
30
45
  $CHEFSPEC_LWRP_PRELOAD[cookbook] = true
31
46
  super
32
47
  end
33
48
 
34
49
  def load_resource_definitions_from_cookbook(cookbook)
35
50
  return super unless $CHEFSPEC_MODE
51
+
36
52
  $CHEFSPEC_DEFINITION_PRELOAD ||= {}
37
53
  # Already loaded this once.
38
54
  return if $CHEFSPEC_DEFINITION_PRELOAD[cookbook]
55
+
39
56
  $CHEFSPEC_DEFINITION_PRELOAD[cookbook] = true
40
57
  super
41
58
  end
@@ -47,18 +64,21 @@ Chef::RunContext::CookbookCompiler.prepend(Module.new do
47
64
  def compile_ohai_plugins
48
65
  return super unless $CHEFSPEC_MODE
49
66
  return if $CHEFSPEC_PRELOAD
67
+
50
68
  super
51
69
  end
52
70
 
53
71
  def compile_attributes
54
72
  return super unless $CHEFSPEC_MODE
55
73
  return if $CHEFSPEC_PRELOAD
74
+
56
75
  super
57
76
  end
58
77
 
59
78
  def compile_recipes
60
79
  return super unless $CHEFSPEC_MODE
61
80
  return if $CHEFSPEC_PRELOAD
81
+
62
82
  super
63
83
  end
64
84
  end)
@@ -1,4 +1,4 @@
1
- require 'chef/mixin/securable'
1
+ require "chef/mixin/securable"
2
2
 
3
3
  class Chef
4
4
  module Mixin
@@ -0,0 +1,11 @@
1
+ require "ohai/system"
2
+
3
+ Ohai::System.prepend(Module.new do
4
+ # If an Ohai segment exists, don't actually pull data in for ohai.
5
+ # (we have fake data for that)
6
+ # @see Ohai::System#run_additional_plugins
7
+ def run_additional_plugins(plugin_path)
8
+ return super unless $CHEFSPEC_MODE
9
+ # noop
10
+ end
11
+ end)
@@ -1,4 +1,4 @@
1
- require 'rspec'
1
+ require "rspec"
2
2
 
3
3
  module ChefSpec::Extensions
4
4
  module Chef
@@ -6,15 +6,16 @@ module ChefSpec::Extensions
6
6
  end
7
7
 
8
8
  # STOP! DO NOT ALPHABETIZE!
9
- require_relative 'extensions/chef/data_query' # must be before Chef::Resource loads
10
- require_relative 'extensions/chef/resource' # must come before client extensions or anything that winds up loading resources
11
- require_relative 'extensions/chef/provider'
12
- require_relative 'extensions/chef/securable'
13
- require_relative 'extensions/chef/client'
14
- require_relative 'extensions/chef/conditional'
15
- require_relative 'extensions/chef/cookbook_uploader'
16
- require_relative 'extensions/chef/cookbook/gem_installer'
17
- require_relative 'extensions/chef/lwrp_base'
18
- require_relative 'extensions/chef/resource/freebsd_package'
19
- require_relative 'extensions/chef/run_context/cookbook_compiler'
20
- require_relative 'extensions/chef/cookbook_loader'
9
+ require_relative "extensions/chef/data_query" # must be before Chef::Resource loads
10
+ require_relative "extensions/chef/resource" # must come before client extensions or anything that winds up loading resources
11
+ require_relative "extensions/chef/provider"
12
+ require_relative "extensions/chef/securable"
13
+ require_relative "extensions/chef/client"
14
+ require_relative "extensions/chef/conditional"
15
+ require_relative "extensions/chef/cookbook_uploader"
16
+ require_relative "extensions/chef/cookbook/gem_installer"
17
+ require_relative "extensions/chef/lwrp_base"
18
+ require_relative "extensions/chef/resource/freebsd_package"
19
+ require_relative "extensions/chef/run_context/cookbook_compiler"
20
+ require_relative "extensions/chef/cookbook_loader"
21
+ require_relative "extensions/ohai/system"
@@ -1,5 +1,5 @@
1
- require 'fileutils'
2
- require 'singleton'
1
+ require "fileutils" unless defined?(FileUtils)
2
+ require "singleton" unless defined?(Singleton)
3
3
 
4
4
  module ChefSpec
5
5
  class FileCachePathProxy
@@ -8,7 +8,7 @@ module ChefSpec
8
8
  attr_reader :file_cache_path
9
9
 
10
10
  def initialize
11
- @file_cache_path = Dir.mktmpdir(["chefspec", "file_cache_path"])
11
+ @file_cache_path = Dir.mktmpdir(%w{chefspec file_cache_path})
12
12
  at_exit { FileUtils.rm_rf(@file_cache_path) }
13
13
  end
14
14
  end
@@ -1,5 +1,5 @@
1
- require 'chef/formatters/base'
2
- require 'chef/formatters/error_mapper'
1
+ require "chef/formatters/base"
2
+ require "chef/formatters/error_mapper"
3
3
 
4
4
  module ChefSpec
5
5
  class ChefFormatter < Chef::Formatters::Base
@@ -133,6 +133,18 @@ module ChefSpec
133
133
  # Called when LWRPs are finished loading
134
134
  def lwrp_load_complete; end
135
135
 
136
+ # Called when an ohai plugin file loading starts
137
+ def ohai_plugin_load_start(file_count); end
138
+
139
+ # Called when an ohai plugin file has been loaded
140
+ def ohai_plugin_file_loaded(path); end
141
+
142
+ # Called when an ohai plugin file has an error on load.
143
+ def ohai_plugin_file_load_failed(path, exception); end
144
+
145
+ # Called when an ohai plugin file loading has finished
146
+ def ohai_plugin_load_complete; end
147
+
136
148
  # Called before attribute files are loaded
137
149
  def attribute_load_start(attribute_file_count); end
138
150
 
@@ -190,7 +202,7 @@ module ChefSpec
190
202
  def converge_complete; end
191
203
 
192
204
  # Called before action is executed on a resource.
193
- def resource_action_start(resource, action, notification_type=nil, notifier=nil); end
205
+ def resource_action_start(resource, action, notification_type = nil, notifier = nil); end
194
206
 
195
207
  # Called when a resource fails, but will retry.
196
208
  def resource_failed_retriable(resource, action, retry_count, exception); end
@@ -1,10 +1,11 @@
1
1
  begin
2
- require 'librarian/chef/environment'
3
- require 'librarian/action/resolve'
4
- require 'librarian/action/install'
2
+ require "librarian/chef/environment"
3
+ require "librarian/action/resolve"
4
+ require "librarian/action/install"
5
5
  rescue LoadError
6
6
  raise ChefSpec::Error::GemLoadError.new(
7
- gem: 'librarian-chef', name: 'Librarian')
7
+ gem: "librarian-chef", name: "Librarian"
8
+ )
8
9
  end
9
10
 
10
11
  module ChefSpec
@@ -25,7 +26,7 @@ module ChefSpec
25
26
  #
26
27
  def setup!
27
28
  env = ::Librarian::Chef::Environment.new(project_path: Dir.pwd)
28
- @originalpath, env.config_db.local['path'] = env.config_db.local['path'], @tmpdir
29
+ @originalpath, env.config_db.local["path"] = env.config_db.local["path"], @tmpdir
29
30
  ::Librarian::Action::Resolve.new(env).run
30
31
  ::Librarian::Action::Install.new(env).run
31
32
 
@@ -37,7 +38,7 @@ module ChefSpec
37
38
  #
38
39
  def teardown!
39
40
  env = ::Librarian::Chef::Environment.new(project_path: Dir.pwd)
40
- env.config_db.local['path'] = @originalpath
41
+ env.config_db.local["path"] = @originalpath
41
42
 
42
43
  FileUtils.rm_rf(@tmpdir) if File.exist?(@tmpdir)
43
44
  end
@@ -14,37 +14,37 @@ module ChefSpec::Matchers
14
14
  end
15
15
 
16
16
  def description
17
- 'do nothing'
17
+ "do nothing"
18
18
  end
19
19
 
20
20
  def failure_message
21
21
  if @resource
22
- message = %|expected #{@resource} to do nothing, but the following |
23
- message << %|actions were performed:|
24
- message << %|\n\n|
22
+ message = %{expected #{@resource} to do nothing, but the following }
23
+ message << %{actions were performed:}
24
+ message << %{\n\n}
25
25
  @resource.performed_actions.each do |action|
26
- message << %| :#{action}|
26
+ message << %{ :#{action}}
27
27
  end
28
28
  message
29
29
  else
30
- message = %|expected _something_ to do nothing, but the _something_ |
31
- message << %|you gave me was nil! If you are running a test like:|
32
- message << %|\n\n|
33
- message << %| expect(_something_).to do_nothing|
34
- message << %|\n\n|
35
- message << %|make sure that `_something_` exists, because I got nil!|
30
+ message = %{expected _something_ to do nothing, but the _something_ }
31
+ message << %{you gave me was nil! If you are running a test like:}
32
+ message << %{\n\n}
33
+ message << %{ expect(_something_).to do_nothing}
34
+ message << %{\n\n}
35
+ message << %{make sure that `_something_` exists, because I got nil!}
36
36
  message
37
37
  end
38
38
  end
39
39
 
40
40
  def failure_message_when_negated
41
41
  if @resource
42
- message = %|expected #{@resource} to do something, but no actions |
43
- message << %|were performed.|
42
+ message = %{expected #{@resource} to do something, but no actions }
43
+ message << %{were performed.}
44
44
  message
45
45
  else
46
- message = %|expected _something_ to do something, but no actions |
47
- message << %|were performed.|
46
+ message = %{expected _something_ to do something, but no actions }
47
+ message << %{were performed.}
48
48
  message
49
49
  end
50
50
  end
@@ -6,15 +6,15 @@ module ChefSpec::Matchers
6
6
  end
7
7
 
8
8
  def description
9
- 'include any recipe'
9
+ "include any recipe"
10
10
  end
11
11
 
12
12
  def failure_message
13
- 'expected to include any recipe'
13
+ "expected to include any recipe"
14
14
  end
15
15
 
16
16
  def failure_message_when_negated
17
- 'expected not to include any recipes'
17
+ "expected not to include any recipes"
18
18
  end
19
19
 
20
20
  private
@@ -36,7 +36,7 @@ module ChefSpec::Matchers
36
36
  # @return [String]
37
37
  #
38
38
  def with_default(name)
39
- name.include?('::') ? name : "#{name}::default"
39
+ name.include?("::") ? name : "#{name}::default"
40
40
  end
41
41
 
42
42
  #
@@ -31,7 +31,7 @@ module ChefSpec::Matchers
31
31
  # @return [String]
32
32
  #
33
33
  def with_default(name)
34
- name.include?('::') ? name : "#{name}::default"
34
+ name.include?("::") ? name : "#{name}::default"
35
35
  end
36
36
 
37
37
  #
@@ -11,8 +11,8 @@ module ChefSpec::Matchers
11
11
  ChefSpec::Coverage.cover!(@link)
12
12
 
13
13
  @link.is_a?(Chef::Resource::Link) &&
14
- @link.performed_action?(:create) &&
15
- @path === @link.to
14
+ @link.performed_action?(:create) &&
15
+ @path === @link.to
16
16
  else
17
17
  false
18
18
  end
@@ -14,8 +14,8 @@ module ChefSpec::Matchers
14
14
  if @resource
15
15
  block = Proc.new do |notified|
16
16
  resource_name(notified.resource).to_s == @expected_resource_type &&
17
- (@expected_resource_name === notified.resource.identity.to_s || @expected_resource_name === notified.resource.name.to_s) &&
18
- matches_action?(notified)
17
+ (@expected_resource_name === notified.resource.identity.to_s || @expected_resource_name === notified.resource.name.to_s) &&
18
+ matches_action?(notified)
19
19
  end
20
20
 
21
21
  if @immediately
@@ -115,6 +115,7 @@ module ChefSpec::Matchers
115
115
 
116
116
  def matches_action?(notification)
117
117
  return true if @action.nil?
118
+
118
119
  @action == notification.action.to_sym
119
120
  end
120
121
 
@@ -130,12 +131,12 @@ module ChefSpec::Matchers
130
131
  type = :delayed
131
132
  end
132
133
 
133
- %Q{ "#{notifying_resource.to_s}" notifies "#{resource_name(resource)}[#{resource.name}]" to :#{notification.action}, :#{type}}
134
+ %Q{ "#{notifying_resource}" notifies "#{resource_name(resource)}[#{resource.name}]" to :#{notification.action}, :#{type}}
134
135
  end
135
136
 
136
137
  def format_notifications
137
138
  all_notifications.map do |notification|
138
- ' ' + format_notification(notification)
139
+ " " + format_notification(notification)
139
140
  end.join("\n")
140
141
  end
141
142
  end
@@ -87,8 +87,8 @@ module ChefSpec::Matchers
87
87
 
88
88
  def resource
89
89
  @resource ||= @runner.find_resource(:cookbook_file, @path) ||
90
- @runner.find_resource(:file, @path) ||
91
- @runner.find_resource(:template, @path)
90
+ @runner.find_resource(:file, @path) ||
91
+ @runner.find_resource(:template, @path)
92
92
  end
93
93
 
94
94
  #
@@ -99,7 +99,7 @@ module ChefSpec::Matchers
99
99
  # @return [true, false]
100
100
  #
101
101
  def has_create_action?
102
- [:create, :create_if_missing].any? { |action| resource.performed_action?(action) }
102
+ %i{create create_if_missing}.any? { |action| resource.performed_action?(action) }
103
103
  end
104
104
 
105
105
  #
@@ -1,5 +1,5 @@
1
- require 'rspec/matchers/expecteds_for_multiple_diffs'
2
- require 'rspec/expectations/fail_with'
1
+ require "rspec/matchers/expecteds_for_multiple_diffs"
2
+ require "rspec/expectations/fail_with"
3
3
 
4
4
  module ChefSpec::Matchers
5
5
  class ResourceMatcher
@@ -15,13 +15,15 @@ module ChefSpec::Matchers
15
15
  end
16
16
 
17
17
  def at_compile_time
18
- raise ArgumentError, 'Cannot specify both .at_converge_time and .at_compile_time!' if @converge_time
18
+ raise ArgumentError, "Cannot specify both .at_converge_time and .at_compile_time!" if @converge_time
19
+
19
20
  @compile_time = true
20
21
  self
21
22
  end
22
23
 
23
24
  def at_converge_time
24
- raise ArgumentError, 'Cannot specify both .at_compile_time and .at_converge_time!' if @compile_time
25
+ raise ArgumentError, "Cannot specify both .at_compile_time and .at_converge_time!" if @compile_time
26
+
25
27
  @converge_time = true
26
28
  self
27
29
  end
@@ -55,20 +57,20 @@ module ChefSpec::Matchers
55
57
  if resource
56
58
  if unmatched_parameters.empty?
57
59
  if @compile_time
58
- %Q{expected "#{resource.to_s}" to be run at compile time}
60
+ %Q{expected "#{resource}" to be run at compile time}
59
61
  else
60
- %Q{expected "#{resource.to_s}" to be run at converge time}
62
+ %Q{expected "#{resource}" to be run at converge time}
61
63
  end
62
64
  else
63
- message = %Q{expected "#{resource.to_s}" to have parameters:} \
65
+ message = %Q{expected "#{resource}" to have parameters:} \
64
66
  "\n\n" \
65
67
  " " + unmatched_parameters.collect { |parameter, h|
66
- msg = "#{parameter} #{h[:expected].inspect}, was #{h[:actual].inspect}"
67
- diff = ::RSpec::Matchers::ExpectedsForMultipleDiffs.from(h[:expected]) \
68
- .message_with_diff(message, ::RSpec::Expectations::differ, h[:actual])
69
- msg += diff if diff
70
- msg
71
- }.join("\n ")
68
+ msg = "#{parameter} #{h[:expected].inspect}, was #{h[:actual].inspect}"
69
+ diff = ::RSpec::Matchers::ExpectedsForMultipleDiffs.from(h[:expected]) \
70
+ .message_with_diff(message, ::RSpec::Expectations.differ, h[:actual])
71
+ msg += diff if diff
72
+ msg
73
+ }.join("\n ")
72
74
  end
73
75
  else
74
76
  %Q{expected "#{@resource_name}[#{@expected_identity}]"} \
@@ -81,9 +83,9 @@ module ChefSpec::Matchers
81
83
 
82
84
  def failure_message_when_negated
83
85
  if resource
84
- message = %Q{expected "#{resource.to_s}" actions #{resource.performed_actions.inspect} to not exist}
86
+ message = %Q{expected "#{resource}" actions #{resource.performed_actions.inspect} to not exist}
85
87
  else
86
- message = %Q{expected "#{resource.to_s}" to not exist}
88
+ message = %Q{expected "#{resource}" to not exist}
87
89
  end
88
90
 
89
91
  message << " at compile time" if @compile_time
@@ -115,7 +117,7 @@ module ChefSpec::Matchers
115
117
  if parameter == :source
116
118
  # Chef 11+ stores the source parameter internally as an Array
117
119
  Array(expected) == Array(value)
118
- elsif expected.kind_of?(Class)
120
+ elsif expected.is_a?(Class)
119
121
  # Ruby can't compare classes with ===
120
122
  expected == value
121
123
  else