test-kitchen 1.14.1 → 1.14.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (127) hide show
  1. checksums.yaml +4 -4
  2. data/Berksfile +1 -1
  3. data/CHANGELOG.md +7 -0
  4. data/Gemfile +1 -1
  5. data/Guardfile +5 -5
  6. data/Rakefile +5 -5
  7. data/bin/kitchen +1 -1
  8. data/features/step_definitions/gem_steps.rb +6 -6
  9. data/features/support/env.rb +6 -7
  10. data/lib/kitchen.rb +5 -7
  11. data/lib/kitchen/base64_stream.rb +2 -8
  12. data/lib/kitchen/cli.rb +76 -80
  13. data/lib/kitchen/collection.rb +0 -2
  14. data/lib/kitchen/color.rb +7 -9
  15. data/lib/kitchen/command.rb +0 -4
  16. data/lib/kitchen/command/action.rb +0 -3
  17. data/lib/kitchen/command/console.rb +4 -7
  18. data/lib/kitchen/command/diagnose.rb +7 -14
  19. data/lib/kitchen/command/driver_discover.rb +1 -4
  20. data/lib/kitchen/command/exec.rb +0 -3
  21. data/lib/kitchen/command/list.rb +9 -12
  22. data/lib/kitchen/command/login.rb +0 -3
  23. data/lib/kitchen/command/package.rb +0 -3
  24. data/lib/kitchen/command/sink.rb +6 -9
  25. data/lib/kitchen/command/test.rb +1 -4
  26. data/lib/kitchen/config.rb +25 -27
  27. data/lib/kitchen/configurable.rb +26 -31
  28. data/lib/kitchen/data_munger.rb +34 -36
  29. data/lib/kitchen/diagnostic.rb +5 -7
  30. data/lib/kitchen/driver.rb +3 -5
  31. data/lib/kitchen/driver/base.rb +0 -3
  32. data/lib/kitchen/driver/dummy.rb +0 -3
  33. data/lib/kitchen/driver/proxy.rb +0 -3
  34. data/lib/kitchen/driver/ssh_base.rb +13 -16
  35. data/lib/kitchen/errors.rb +11 -16
  36. data/lib/kitchen/generator/driver_create.rb +18 -21
  37. data/lib/kitchen/generator/init.rb +21 -26
  38. data/lib/kitchen/instance.rb +19 -23
  39. data/lib/kitchen/lazy_hash.rb +1 -2
  40. data/lib/kitchen/loader/yaml.rb +22 -25
  41. data/lib/kitchen/logger.rb +9 -14
  42. data/lib/kitchen/logging.rb +0 -3
  43. data/lib/kitchen/login_command.rb +0 -2
  44. data/lib/kitchen/metadata_chopper.rb +0 -2
  45. data/lib/kitchen/platform.rb +1 -3
  46. data/lib/kitchen/provisioner.rb +3 -5
  47. data/lib/kitchen/provisioner/base.rb +2 -5
  48. data/lib/kitchen/provisioner/chef/berkshelf.rb +1 -5
  49. data/lib/kitchen/provisioner/chef/common_sandbox.rb +24 -29
  50. data/lib/kitchen/provisioner/chef/librarian.rb +2 -6
  51. data/lib/kitchen/provisioner/chef/policyfile.rb +4 -8
  52. data/lib/kitchen/provisioner/chef_apply.rb +14 -17
  53. data/lib/kitchen/provisioner/chef_base.rb +43 -46
  54. data/lib/kitchen/provisioner/chef_solo.rb +10 -13
  55. data/lib/kitchen/provisioner/chef_zero.rb +22 -29
  56. data/lib/kitchen/provisioner/dummy.rb +0 -3
  57. data/lib/kitchen/provisioner/shell.rb +6 -9
  58. data/lib/kitchen/rake_tasks.rb +4 -6
  59. data/lib/kitchen/shell_out.rb +3 -5
  60. data/lib/kitchen/ssh.rb +16 -22
  61. data/lib/kitchen/state_file.rb +3 -5
  62. data/lib/kitchen/suite.rb +0 -2
  63. data/lib/kitchen/thor_tasks.rb +2 -4
  64. data/lib/kitchen/transport.rb +3 -5
  65. data/lib/kitchen/transport/base.rb +1 -7
  66. data/lib/kitchen/transport/dummy.rb +0 -4
  67. data/lib/kitchen/transport/ssh.rb +41 -47
  68. data/lib/kitchen/transport/winrm.rb +41 -40
  69. data/lib/kitchen/util.rb +1 -3
  70. data/lib/kitchen/verifier.rb +3 -5
  71. data/lib/kitchen/verifier/base.rb +2 -5
  72. data/lib/kitchen/verifier/busser.rb +24 -24
  73. data/lib/kitchen/verifier/dummy.rb +0 -3
  74. data/lib/kitchen/verifier/shell.rb +1 -3
  75. data/lib/kitchen/version.rb +1 -1
  76. data/lib/vendor/hash_recursive_merge.rb +0 -2
  77. data/spec/kitchen/base64_stream_spec.rb +3 -6
  78. data/spec/kitchen/cli_spec.rb +0 -2
  79. data/spec/kitchen/collection_spec.rb +4 -8
  80. data/spec/kitchen/color_spec.rb +0 -3
  81. data/spec/kitchen/config_spec.rb +91 -106
  82. data/spec/kitchen/configurable_spec.rb +44 -76
  83. data/spec/kitchen/data_munger_spec.rb +1178 -1247
  84. data/spec/kitchen/diagnostic_spec.rb +37 -38
  85. data/spec/kitchen/driver/base_spec.rb +7 -14
  86. data/spec/kitchen/driver/dummy_spec.rb +1 -7
  87. data/spec/kitchen/driver/proxy_spec.rb +2 -7
  88. data/spec/kitchen/driver/ssh_base_spec.rb +128 -149
  89. data/spec/kitchen/driver_spec.rb +7 -13
  90. data/spec/kitchen/errors_spec.rb +50 -60
  91. data/spec/kitchen/instance_spec.rb +217 -294
  92. data/spec/kitchen/lazy_hash_spec.rb +14 -18
  93. data/spec/kitchen/loader/yaml_spec.rb +201 -227
  94. data/spec/kitchen/logger_spec.rb +7 -15
  95. data/spec/kitchen/logging_spec.rb +1 -4
  96. data/spec/kitchen/login_command_spec.rb +3 -4
  97. data/spec/kitchen/metadata_chopper_spec.rb +0 -3
  98. data/spec/kitchen/platform_spec.rb +31 -32
  99. data/spec/kitchen/provisioner/base_spec.rb +22 -41
  100. data/spec/kitchen/provisioner/chef/policyfile_spec.rb +15 -15
  101. data/spec/kitchen/provisioner/chef_apply_spec.rb +8 -13
  102. data/spec/kitchen/provisioner/chef_base_spec.rb +150 -182
  103. data/spec/kitchen/provisioner/chef_solo_spec.rb +58 -72
  104. data/spec/kitchen/provisioner/chef_zero_spec.rb +99 -125
  105. data/spec/kitchen/provisioner/dummy_spec.rb +8 -11
  106. data/spec/kitchen/provisioner/shell_spec.rb +86 -103
  107. data/spec/kitchen/provisioner_spec.rb +5 -11
  108. data/spec/kitchen/shell_out_spec.rb +15 -19
  109. data/spec/kitchen/ssh_spec.rb +16 -35
  110. data/spec/kitchen/state_file_spec.rb +6 -11
  111. data/spec/kitchen/suite_spec.rb +5 -6
  112. data/spec/kitchen/transport/base_spec.rb +6 -14
  113. data/spec/kitchen/transport/ssh_spec.rb +39 -64
  114. data/spec/kitchen/transport/winrm_spec.rb +99 -127
  115. data/spec/kitchen/transport_spec.rb +7 -13
  116. data/spec/kitchen/util_spec.rb +17 -26
  117. data/spec/kitchen/verifier/base_spec.rb +24 -40
  118. data/spec/kitchen/verifier/busser_spec.rb +38 -68
  119. data/spec/kitchen/verifier/dummy_spec.rb +8 -11
  120. data/spec/kitchen/verifier/shell_spec.rb +14 -17
  121. data/spec/kitchen/verifier_spec.rb +7 -13
  122. data/spec/kitchen_spec.rb +4 -6
  123. data/spec/spec_helper.rb +1 -1
  124. data/spec/support/powershell_max_size_spec.rb +1 -2
  125. data/support/chef-client-zero.rb +3 -4
  126. data/test-kitchen.gemspec +4 -6
  127. metadata +9 -9
@@ -26,14 +26,11 @@ require "kitchen/driver"
26
26
  require "kitchen/driver/base"
27
27
 
28
28
  module Kitchen
29
-
30
29
  module Driver
31
-
32
30
  class Coolbeans < Kitchen::Driver::Base
33
31
  end
34
32
 
35
33
  class ItDepends < Kitchen::Driver::Base
36
-
37
34
  attr_reader :verify_call_count
38
35
 
39
36
  def initialize(config = {})
@@ -47,7 +44,6 @@ module Kitchen
47
44
  end
48
45
 
49
46
  class UnstableDepends < Kitchen::Driver::Base
50
-
51
47
  def verify_dependencies
52
48
  raise UserError, "Oh noes, you don't have software!"
53
49
  end
@@ -56,9 +52,7 @@ module Kitchen
56
52
  end
57
53
 
58
54
  describe Kitchen::Driver do
59
-
60
55
  describe ".for_plugin" do
61
-
62
56
  before do
63
57
  Kitchen::Driver.stubs(:require).returns(true)
64
58
  end
@@ -70,7 +64,7 @@ describe Kitchen::Driver do
70
64
  end
71
65
 
72
66
  it "returns a driver initialized with its config" do
73
- driver = Kitchen::Driver.for_plugin("coolbeans", :jelly => "beans")
67
+ driver = Kitchen::Driver.for_plugin("coolbeans", jelly: "beans")
74
68
 
75
69
  driver[:jelly].must_equal "beans"
76
70
  end
@@ -93,20 +87,20 @@ describe Kitchen::Driver do
93
87
  it "raises ClientError if the driver could not be required" do
94
88
  Kitchen::Driver.stubs(:require).raises(LoadError)
95
89
 
96
- proc { Kitchen::Driver.for_plugin("coolbeans", {}) }.
97
- must_raise Kitchen::ClientError
90
+ proc { Kitchen::Driver.for_plugin("coolbeans", {}) }
91
+ .must_raise Kitchen::ClientError
98
92
  end
99
93
 
100
94
  it "raises ClientError if the driver's class constant could not be found" do
101
95
  Kitchen::Driver.stubs(:require).returns(true) # pretend require worked
102
96
 
103
- proc { Kitchen::Driver.for_plugin("nope", {}) }.
104
- must_raise Kitchen::ClientError
97
+ proc { Kitchen::Driver.for_plugin("nope", {}) }
98
+ .must_raise Kitchen::ClientError
105
99
  end
106
100
 
107
101
  it "raises UserError if #verify_dependencies fails" do
108
- proc { Kitchen::Driver.for_plugin("unstable_depends", {}) }.
109
- must_raise Kitchen::UserError
102
+ proc { Kitchen::Driver.for_plugin("unstable_depends", {}) }
103
+ .must_raise Kitchen::UserError
110
104
  end
111
105
  end
112
106
  end
@@ -22,35 +22,32 @@ require "kitchen"
22
22
  require "kitchen/errors"
23
23
 
24
24
  describe Kitchen::Error do
25
-
26
25
  let(:exception) { Kitchen::StandardError.new("shoot") }
27
26
 
28
27
  describe ".formatted_exception" do
29
-
30
28
  it "returns an array of a formatted message" do
31
29
  Kitchen::Error.formatted_exception(exception).must_equal([
32
- "------Exception-------",
33
- "Class: Kitchen::StandardError",
34
- "Message: shoot",
35
- "----------------------"
36
- ])
30
+ "------Exception-------",
31
+ "Class: Kitchen::StandardError",
32
+ "Message: shoot",
33
+ "----------------------",
34
+ ])
37
35
  end
38
36
 
39
37
  it "takes a customized title" do
40
- Kitchen::Error.formatted_exception(exception, "Trouble").first.
41
- must_equal("-------Trouble--------")
38
+ Kitchen::Error.formatted_exception(exception, "Trouble").first
39
+ .must_equal("-------Trouble--------")
42
40
  end
43
41
  end
44
42
 
45
43
  describe ".formatted_exception" do
46
-
47
44
  it "returns an array of a formatted message with a nil backtrace" do
48
45
  Kitchen::Error.formatted_trace(exception).must_equal([
49
- "------Exception-------",
50
- "Class: Kitchen::StandardError",
51
- "Message: shoot",
52
- "----------------------"
53
- ])
46
+ "------Exception-------",
47
+ "Class: Kitchen::StandardError",
48
+ "Message: shoot",
49
+ "----------------------",
50
+ ])
54
51
  end
55
52
 
56
53
  it "returns an array containing the exception's backtrace" do
@@ -68,15 +65,15 @@ describe Kitchen::Error do
68
65
  e = Kitchen::StandardError.new("shoot")
69
66
 
70
67
  Kitchen::Error.formatted_trace(e).must_equal([
71
- "------Exception-------",
72
- "Class: Kitchen::StandardError",
73
- "Message: shoot",
74
- "----------------------",
75
- "---Nested Exception---",
76
- "Class: IOError",
77
- "Message: no disk, yo",
78
- "----------------------"
79
- ])
68
+ "------Exception-------",
69
+ "Class: Kitchen::StandardError",
70
+ "Message: shoot",
71
+ "----------------------",
72
+ "---Nested Exception---",
73
+ "Class: IOError",
74
+ "Message: no disk, yo",
75
+ "----------------------",
76
+ ])
80
77
  end
81
78
  end
82
79
 
@@ -87,24 +84,23 @@ describe Kitchen::Error do
87
84
  composite_error = Kitchen::StandardError.new("array", error_array)
88
85
 
89
86
  Kitchen::Error.formatted_trace(composite_error).must_equal([
90
- "------Exception-------",
91
- "Class: Kitchen::StandardError",
92
- "Message: array",
93
- "----------------------",
94
- "-Composite Exception--",
95
- "Class: Kitchen::StandardError",
96
- "Message: one", "----------------------",
97
- "-Composite Exception--",
98
- "Class: Kitchen::StandardError",
99
- "Message: two",
100
- "----------------------"
101
- ])
87
+ "------Exception-------",
88
+ "Class: Kitchen::StandardError",
89
+ "Message: array",
90
+ "----------------------",
91
+ "-Composite Exception--",
92
+ "Class: Kitchen::StandardError",
93
+ "Message: one", "----------------------",
94
+ "-Composite Exception--",
95
+ "Class: Kitchen::StandardError",
96
+ "Message: two",
97
+ "----------------------"
98
+ ])
102
99
  end
103
100
  end
104
101
  end
105
102
 
106
103
  describe Kitchen::StandardError do
107
-
108
104
  it "is a kind of Kitchen::Error" do
109
105
  Kitchen::StandardError.new("oops").must_be_kind_of Kitchen::Error
110
106
  end
@@ -130,7 +126,6 @@ end
130
126
  Kitchen::UserError, Kitchen::ClientError, Kitchen::TransientFailure
131
127
  ].each do |klass|
132
128
  describe klass do
133
-
134
129
  it "is a kind of Kitchen::StandardError" do
135
130
  klass.new("oops").must_be_kind_of Kitchen::StandardError
136
131
  end
@@ -141,7 +136,6 @@ end
141
136
  Kitchen::ActionFailed, Kitchen::InstanceFailure
142
137
  ].each do |klass|
143
138
  describe klass do
144
-
145
139
  it "is a kind of Kitchen::TransientFailure" do
146
140
  klass.new("oops").must_be_kind_of Kitchen::TransientFailure
147
141
  end
@@ -149,11 +143,9 @@ end
149
143
  end
150
144
 
151
145
  describe Kitchen do
152
-
153
146
  describe ".with_friendly_errors" do
154
-
155
147
  let(:logger_io) { StringIO.new }
156
- let(:logger) { Kitchen::Logger.new(:logdev => logger_io) }
148
+ let(:logger) { Kitchen::Logger.new(logdev: logger_io) }
157
149
 
158
150
  before do
159
151
  Kitchen.stubs(:tty?).returns(true)
@@ -169,7 +161,6 @@ describe Kitchen do
169
161
  end
170
162
 
171
163
  describe "for instance failures" do
172
-
173
164
  def go_boom
174
165
  Kitchen.with_friendly_errors do
175
166
  begin
@@ -194,7 +185,7 @@ describe Kitchen do
194
185
  ">>>>>> ------Exception-------",
195
186
  ">>>>>> Class: IOError",
196
187
  ">>>>>> Message: no stuff",
197
- ">>>>>> ----------------------"
188
+ ">>>>>> ----------------------",
198
189
  ].map { |l| Kitchen::Color.colorize(l, :red) }.join("\n").concat("\n")
199
190
 
200
191
  begin
@@ -211,7 +202,7 @@ describe Kitchen do
211
202
  ">>>>>> ------Exception-------",
212
203
  ">>>>>> Class: IOError",
213
204
  ">>>>>> Message: no stuff",
214
- ">>>>>> ----------------------"
205
+ ">>>>>> ----------------------",
215
206
  ].join("\n").concat("\n")
216
207
 
217
208
  begin
@@ -241,7 +232,6 @@ describe Kitchen do
241
232
  end
242
233
 
243
234
  describe "for unexpected failures" do
244
-
245
235
  def go_boom
246
236
  Kitchen.with_friendly_errors do
247
237
  begin
@@ -267,7 +257,7 @@ describe Kitchen do
267
257
  ">>>>>> Message: ah crap",
268
258
  ">>>>>> ----------------------",
269
259
  ">>>>>> Please see .kitchen/logs/kitchen.log for more details",
270
- ">>>>>> Also try running `kitchen diagnose --all` for configuration\n"
260
+ ">>>>>> Also try running `kitchen diagnose --all` for configuration\n",
271
261
  ].map { |l| Kitchen::Color.colorize(l, :red) }.join("\n").concat("\n")
272
262
 
273
263
  begin
@@ -285,7 +275,7 @@ describe Kitchen do
285
275
  ">>>>>> Message: ah crap",
286
276
  ">>>>>> ----------------------",
287
277
  ">>>>>> Please see .kitchen/logs/kitchen.log for more details",
288
- ">>>>>> Also try running `kitchen diagnose --all` for configuration"
278
+ ">>>>>> Also try running `kitchen diagnose --all` for configuration",
289
279
  ].join("\n").concat("\n")
290
280
 
291
281
  begin
@@ -299,12 +289,12 @@ describe Kitchen do
299
289
  begin
300
290
  go_boom
301
291
  rescue SystemExit
302
- logger_io.string.
303
- must_match(/ERROR -- Kitchen: ------Exception-------$/)
304
- logger_io.string.
305
- must_match(/ERROR -- Kitchen: Class: Kitchen::StandardError$/)
306
- logger_io.string.
307
- must_match(/ERROR -- Kitchen: ------Backtrace-------$/)
292
+ logger_io.string
293
+ .must_match(/ERROR -- Kitchen: ------Exception-------$/)
294
+ logger_io.string
295
+ .must_match(/ERROR -- Kitchen: Class: Kitchen::StandardError$/)
296
+ logger_io.string
297
+ .must_match(/ERROR -- Kitchen: ------Backtrace-------$/)
308
298
  end
309
299
  end
310
300
 
@@ -314,12 +304,12 @@ describe Kitchen do
314
304
  begin
315
305
  go_boom
316
306
  rescue SystemExit
317
- logger_io.string.
318
- must_match(/DEBUG -- Kitchen: ------Exception-------$/)
319
- logger_io.string.
320
- must_match(/DEBUG -- Kitchen: Class: Kitchen::StandardError$/)
321
- logger_io.string.
322
- must_match(/DEBUG -- Kitchen: ------Backtrace-------$/)
307
+ logger_io.string
308
+ .must_match(/DEBUG -- Kitchen: ------Exception-------$/)
309
+ logger_io.string
310
+ .must_match(/DEBUG -- Kitchen: Class: Kitchen::StandardError$/)
311
+ logger_io.string
312
+ .must_match(/DEBUG -- Kitchen: ------Backtrace-------$/)
323
313
  end
324
314
  end
325
315
  end
@@ -31,11 +31,10 @@ require "kitchen/transport/dummy"
31
31
  require "kitchen/verifier/dummy"
32
32
 
33
33
  class DummyStateFile
34
-
35
34
  def initialize(*); end
36
35
 
37
36
  def read
38
- @_state = Hash.new unless @_state
37
+ @_state = {} unless @_state
39
38
  @_state.dup
40
39
  end
41
40
 
@@ -48,18 +47,17 @@ class DummyStateFile
48
47
  end
49
48
 
50
49
  def diagnose
51
- Hash.new
50
+ {}
52
51
  end
53
52
  end
54
53
 
55
54
  class SerialDummyDriver < Kitchen::Driver::Dummy
56
-
57
55
  no_parallel_for :create, :destroy
58
56
 
59
57
  attr_reader :action_in_mutex
60
58
 
61
59
  def track_locked(action)
62
- @action_in_mutex = Hash.new unless @action_in_mutex
60
+ @action_in_mutex = {} unless @action_in_mutex
63
61
  @action_in_mutex[action] = Kitchen::Instance.mutexes[self.class].locked?
64
62
  end
65
63
 
@@ -75,7 +73,6 @@ class SerialDummyDriver < Kitchen::Driver::Dummy
75
73
  end
76
74
 
77
75
  class LegacyDriver < Kitchen::Driver::SSHBase
78
-
79
76
  attr_reader :called_converge, :called_setup, :called_verify
80
77
 
81
78
  def converge(_)
@@ -92,10 +89,9 @@ class LegacyDriver < Kitchen::Driver::SSHBase
92
89
  end
93
90
 
94
91
  describe Kitchen::Instance do
95
-
96
92
  let(:driver) { Kitchen::Driver::Dummy.new({}) }
97
93
  let(:logger_io) { StringIO.new }
98
- let(:logger) { Kitchen::Logger.new(:logdev => logger_io) }
94
+ let(:logger) { Kitchen::Logger.new(logdev: logger_io) }
99
95
  let(:instance) { Kitchen::Instance.new(opts) }
100
96
  let(:provisioner) { Kitchen::Provisioner::Dummy.new({}) }
101
97
  let(:state_file) { DummyStateFile.new }
@@ -103,74 +99,72 @@ describe Kitchen::Instance do
103
99
  let(:verifier) { Kitchen::Verifier::Dummy.new({}) }
104
100
 
105
101
  let(:opts) do
106
- { :suite => suite, :platform => platform, :driver => driver,
107
- :provisioner => provisioner, :verifier => verifier,
108
- :logger => logger, :state_file => state_file, :transport => transport }
102
+ { suite: suite, platform: platform, driver: driver,
103
+ provisioner: provisioner, verifier: verifier,
104
+ logger: logger, state_file: state_file, transport: transport }
109
105
  end
110
106
 
111
107
  def suite(name = "suite")
112
- @suite ||= Kitchen::Suite.new(:name => name)
108
+ @suite ||= Kitchen::Suite.new(name: name)
113
109
  end
114
110
 
115
111
  def platform(name = "platform")
116
- @platform ||= Kitchen::Platform.new(:name => name)
112
+ @platform ||= Kitchen::Platform.new(name: name)
117
113
  end
118
114
 
119
115
  describe ".name_for" do
120
-
121
116
  it "combines the suite and platform names with a dash" do
122
- Kitchen::Instance.name_for(suite("suite"), platform("platform")).
123
- must_equal "suite-platform"
117
+ Kitchen::Instance.name_for(suite("suite"), platform("platform"))
118
+ .must_equal "suite-platform"
124
119
  end
125
120
 
126
121
  it "squashes periods in suite name" do
127
- Kitchen::Instance.name_for(suite("suite.ness"), platform("platform")).
128
- must_equal "suiteness-platform"
122
+ Kitchen::Instance.name_for(suite("suite.ness"), platform("platform"))
123
+ .must_equal "suiteness-platform"
129
124
  end
130
125
 
131
126
  it "squashes periods in platform name" do
132
- Kitchen::Instance.name_for(suite("suite"), platform("platform.s")).
133
- must_equal "suite-platforms"
127
+ Kitchen::Instance.name_for(suite("suite"), platform("platform.s"))
128
+ .must_equal "suite-platforms"
134
129
  end
135
130
 
136
131
  it "squashes periods in suite and platform names" do
137
- Kitchen::Instance.name_for(suite("s.s"), platform("p.p")).
138
- must_equal "ss-pp"
132
+ Kitchen::Instance.name_for(suite("s.s"), platform("p.p"))
133
+ .must_equal "ss-pp"
139
134
  end
140
135
 
141
136
  it "transforms underscores to dashes in suite name" do
142
- Kitchen::Instance.name_for(suite("suite_ness"), platform("platform")).
143
- must_equal "suite-ness-platform"
137
+ Kitchen::Instance.name_for(suite("suite_ness"), platform("platform"))
138
+ .must_equal "suite-ness-platform"
144
139
  end
145
140
 
146
141
  it "transforms underscores to dashes in platform name" do
147
- Kitchen::Instance.name_for(suite("suite"), platform("platform_s")).
148
- must_equal "suite-platform-s"
142
+ Kitchen::Instance.name_for(suite("suite"), platform("platform_s"))
143
+ .must_equal "suite-platform-s"
149
144
  end
150
145
 
151
146
  it "transforms underscores to dashes in suite and platform names" do
152
- Kitchen::Instance.name_for(suite("_s__s_"), platform("pp_")).
153
- must_equal "-s--s--pp-"
147
+ Kitchen::Instance.name_for(suite("_s__s_"), platform("pp_"))
148
+ .must_equal "-s--s--pp-"
154
149
  end
155
150
 
156
151
  it "transforms forward slashes to dashes in suite name" do
157
- Kitchen::Instance.name_for(suite("suite/ness"), platform("platform")).
158
- must_equal "suite-ness-platform"
152
+ Kitchen::Instance.name_for(suite("suite/ness"), platform("platform"))
153
+ .must_equal "suite-ness-platform"
159
154
  end
160
155
 
161
156
  it "transforms forward slashes to dashes in platform name" do
162
- Kitchen::Instance.name_for(suite("suite"), platform("platform/s")).
163
- must_equal "suite-platform-s"
157
+ Kitchen::Instance.name_for(suite("suite"), platform("platform/s"))
158
+ .must_equal "suite-platform-s"
164
159
  end
165
160
 
166
161
  it "transforms forward slashes to dashes in suite and platform names" do
167
- Kitchen::Instance.name_for(suite("/s//s/"), platform("pp/")).
168
- must_equal "-s--s--pp-"
162
+ Kitchen::Instance.name_for(suite("/s//s/"), platform("pp/"))
163
+ .must_equal "-s--s--pp-"
169
164
  end
170
165
  end
171
166
 
172
167
  describe "#suite" do
173
-
174
168
  it "returns its suite" do
175
169
  instance.suite.must_equal suite
176
170
  end
@@ -182,7 +176,6 @@ describe Kitchen::Instance do
182
176
  end
183
177
 
184
178
  describe "#platform" do
185
-
186
179
  it "returns its platform" do
187
180
  instance.platform.must_equal platform
188
181
  end
@@ -194,7 +187,6 @@ describe Kitchen::Instance do
194
187
  end
195
188
 
196
189
  describe "#driver" do
197
-
198
190
  it "returns its driver" do
199
191
  instance.driver.must_equal driver
200
192
  end
@@ -211,7 +203,6 @@ describe Kitchen::Instance do
211
203
  end
212
204
 
213
205
  describe "#logger" do
214
-
215
206
  it "returns its logger" do
216
207
  instance.logger.must_equal logger
217
208
  end
@@ -223,7 +214,6 @@ describe Kitchen::Instance do
223
214
  end
224
215
 
225
216
  describe "#provisioner" do
226
-
227
217
  it "returns its provisioner" do
228
218
  instance.provisioner.must_equal provisioner
229
219
  end
@@ -240,7 +230,6 @@ describe Kitchen::Instance do
240
230
  end
241
231
 
242
232
  describe "#transport" do
243
-
244
233
  it "returns its transport" do
245
234
  instance.transport.must_equal transport
246
235
  end
@@ -257,7 +246,6 @@ describe Kitchen::Instance do
257
246
  end
258
247
 
259
248
  describe "#verifier" do
260
-
261
249
  it "returns its verifier" do
262
250
  instance.verifier.must_equal verifier
263
251
  end
@@ -274,7 +262,6 @@ describe Kitchen::Instance do
274
262
  end
275
263
 
276
264
  describe "#state_file" do
277
-
278
265
  it "raises an ArgumentError if missing" do
279
266
  opts.delete(:state_file)
280
267
  proc { Kitchen::Instance.new(opts) }.must_raise Kitchen::ClientError
@@ -291,12 +278,12 @@ describe Kitchen::Instance do
291
278
 
292
279
  it "#login executes the transport's login_command" do
293
280
  conn = stub("connection")
294
- state_file.write(:last_action => "create")
295
- transport.stubs(:connection).with(:last_action => "create").
296
- returns(conn)
297
- conn.stubs(:login_command).
298
- returns(Kitchen::LoginCommand.new("echo", ["hello"], :purple => true))
299
- Kernel.expects(:exec).with("echo", "hello", :purple => true)
281
+ state_file.write(last_action: "create")
282
+ transport.stubs(:connection).with(last_action: "create")
283
+ .returns(conn)
284
+ conn.stubs(:login_command)
285
+ .returns(Kitchen::LoginCommand.new("echo", ["hello"], purple: true))
286
+ Kernel.expects(:exec).with("echo", "hello", purple: true)
300
287
 
301
288
  instance.login
302
289
  end
@@ -308,165 +295,160 @@ describe Kitchen::Instance do
308
295
  end
309
296
 
310
297
  describe "#diagnose" do
311
-
312
298
  it "returns a hash" do
313
299
  instance.diagnose.must_be_instance_of Hash
314
300
  end
315
301
 
316
302
  it "sets :platform key to platform's diagnose info" do
317
- platform.stubs(:diagnose).returns(:a => "b")
303
+ platform.stubs(:diagnose).returns(a: "b")
318
304
 
319
- instance.diagnose[:platform].must_equal(:a => "b")
305
+ instance.diagnose[:platform].must_equal(a: "b")
320
306
  end
321
307
 
322
308
  it "sets :platform key to :unknown if obj can't respond to #diagnose" do
323
- opts[:platform] = Class.new(platform.class) {
309
+ opts[:platform] = Class.new(platform.class) do
324
310
  undef_method :diagnose
325
- }.new(:name => "whoop")
311
+ end.new(name: "whoop")
326
312
 
327
313
  instance.diagnose[:platform].must_equal :unknown
328
314
  end
329
315
 
330
316
  it "sets :state_file key to state_file's diganose info" do
331
- state_file.stubs(:diagnose).returns(:a => "b")
317
+ state_file.stubs(:diagnose).returns(a: "b")
332
318
 
333
- instance.diagnose[:state_file].must_equal(:a => "b")
319
+ instance.diagnose[:state_file].must_equal(a: "b")
334
320
  end
335
321
 
336
322
  it "sets :state_file key to :unknown if obj can't respond to #diagnose" do
337
- opts[:state_file] = Class.new(state_file.class) {
323
+ opts[:state_file] = Class.new(state_file.class) do
338
324
  undef_method :diagnose
339
- }.new
325
+ end.new
340
326
 
341
327
  instance.diagnose[:state_file].must_equal :unknown
342
328
  end
343
329
 
344
330
  it "sets :provisioner key to provisioner's diganose info" do
345
- provisioner.stubs(:diagnose).returns(:a => "b")
331
+ provisioner.stubs(:diagnose).returns(a: "b")
346
332
 
347
- instance.diagnose[:provisioner].must_equal(:a => "b")
333
+ instance.diagnose[:provisioner].must_equal(a: "b")
348
334
  end
349
335
 
350
336
  it "sets :provisioner key to :unknown if obj can't respond to #diagnose" do
351
- opts[:provisioner] = Class.new(provisioner.class) {
337
+ opts[:provisioner] = Class.new(provisioner.class) do
352
338
  undef_method :diagnose
353
- }.new
339
+ end.new
354
340
 
355
341
  instance.diagnose[:provisioner].must_equal :unknown
356
342
  end
357
343
 
358
344
  it "sets :verifier key to verifier's diganose info" do
359
- verifier.stubs(:diagnose).returns(:a => "b")
345
+ verifier.stubs(:diagnose).returns(a: "b")
360
346
 
361
- instance.diagnose[:verifier].must_equal(:a => "b")
347
+ instance.diagnose[:verifier].must_equal(a: "b")
362
348
  end
363
349
 
364
350
  it "sets :verifier key to :unknown if obj can't respond to #diagnose" do
365
- opts[:verifier] = Class.new(verifier.class) {
351
+ opts[:verifier] = Class.new(verifier.class) do
366
352
  undef_method :diagnose
367
- }.new({})
353
+ end.new({})
368
354
 
369
355
  instance.diagnose[:verifier].must_equal :unknown
370
356
  end
371
357
 
372
358
  it "sets :transport key to transport's diganose info" do
373
- transport.stubs(:diagnose).returns(:a => "b")
359
+ transport.stubs(:diagnose).returns(a: "b")
374
360
 
375
- instance.diagnose[:transport].must_equal(:a => "b")
361
+ instance.diagnose[:transport].must_equal(a: "b")
376
362
  end
377
363
 
378
364
  it "sets :transport key to :unknown if obj can't respond to #diagnose" do
379
- opts[:transport] = Class.new(transport.class) {
365
+ opts[:transport] = Class.new(transport.class) do
380
366
  undef_method :diagnose
381
- }.new
367
+ end.new
382
368
 
383
369
  instance.diagnose[:transport].must_equal :unknown
384
370
  end
385
371
  end
386
372
 
387
373
  describe "#diagnose_plugins" do
388
-
389
374
  it "returns a hash" do
390
375
  instance.diagnose_plugins.must_be_instance_of Hash
391
376
  end
392
377
 
393
378
  it "sets :driver key to driver's plugin_diagnose info" do
394
- driver.class.stubs(:diagnose).returns(:a => "b")
379
+ driver.class.stubs(:diagnose).returns(a: "b")
395
380
 
396
381
  instance.diagnose_plugins[:driver].must_equal(
397
- :name => "Dummy",
398
- :a => "b"
382
+ name: "Dummy",
383
+ a: "b"
399
384
  )
400
385
  end
401
386
 
402
387
  it "sets :driver key to :unknown if class doesn't have #diagnose" do
403
- opts[:driver] = Class.new(driver.class) {
388
+ opts[:driver] = Class.new(driver.class) do
404
389
  undef_method :diagnose_plugin
405
- }.new({})
390
+ end.new({})
406
391
 
407
392
  instance.diagnose_plugins[:driver].must_equal(:unknown)
408
393
  end
409
394
 
410
395
  it "sets :provisioner key to provisioner's plugin_diagnose info" do
411
- provisioner.class.stubs(:diagnose).returns(:a => "b")
396
+ provisioner.class.stubs(:diagnose).returns(a: "b")
412
397
 
413
398
  instance.diagnose_plugins[:provisioner].must_equal(
414
- :name => "Dummy",
415
- :a => "b"
399
+ name: "Dummy",
400
+ a: "b"
416
401
  )
417
402
  end
418
403
 
419
404
  it "sets :provisioner key to :unknown if class doesn't have #diagnose" do
420
- opts[:provisioner] = Class.new(driver.class) {
405
+ opts[:provisioner] = Class.new(driver.class) do
421
406
  undef_method :diagnose_plugin
422
- }.new({})
407
+ end.new({})
423
408
 
424
409
  instance.diagnose_plugins[:provisioner].must_equal(:unknown)
425
410
  end
426
411
 
427
412
  it "sets :verifier key to verifier's plugin_diagnose info" do
428
- verifier.class.stubs(:diagnose).returns(:a => "b")
413
+ verifier.class.stubs(:diagnose).returns(a: "b")
429
414
 
430
415
  instance.diagnose_plugins[:verifier].must_equal(
431
- :name => "Dummy",
432
- :a => "b"
416
+ name: "Dummy",
417
+ a: "b"
433
418
  )
434
419
  end
435
420
 
436
421
  it "sets :verifier key to :unknown if class doesn't have #diagnose" do
437
- opts[:verifier] = Class.new(verifier.class) {
422
+ opts[:verifier] = Class.new(verifier.class) do
438
423
  undef_method :diagnose_plugin
439
- }.new({})
424
+ end.new({})
440
425
 
441
426
  instance.diagnose_plugins[:verifier].must_equal(:unknown)
442
427
  end
443
428
 
444
429
  it "sets :transport key to transport's plugin_diagnose info" do
445
- transport.class.stubs(:diagnose).returns(:a => "b")
430
+ transport.class.stubs(:diagnose).returns(a: "b")
446
431
 
447
432
  instance.diagnose_plugins[:transport].must_equal(
448
- :name => "Dummy",
449
- :a => "b"
433
+ name: "Dummy",
434
+ a: "b"
450
435
  )
451
436
  end
452
437
 
453
438
  it "sets :transport key to :unknown if class doesn't have #diagnose" do
454
- opts[:transport] = Class.new(transport.class) {
439
+ opts[:transport] = Class.new(transport.class) do
455
440
  undef_method :diagnose_plugin
456
- }.new({})
441
+ end.new({})
457
442
 
458
443
  instance.diagnose_plugins[:transport].must_equal(:unknown)
459
444
  end
460
445
  end
461
446
 
462
447
  describe "performing actions" do
463
-
464
448
  describe "#create" do
465
-
466
449
  describe "with no state" do
467
-
468
450
  it "calls Driver#create with empty state hash" do
469
- driver.expects(:create).with(Hash.new)
451
+ driver.expects(:create).with({})
470
452
 
471
453
  instance.create
472
454
  end
@@ -486,19 +468,17 @@ describe Kitchen::Instance do
486
468
  it "logs the action finish" do
487
469
  instance.create
488
470
 
489
- logger_io.string.
490
- must_match regex_for("Finished creating #{instance.to_str}")
471
+ logger_io.string
472
+ .must_match regex_for("Finished creating #{instance.to_str}")
491
473
  end
492
-
493
474
  end
494
475
 
495
476
  describe "with last_action of create" do
496
-
497
- before { state_file.write(:last_action => "create") }
477
+ before { state_file.write(last_action: "create") }
498
478
 
499
479
  it "calls Driver#create with state hash" do
500
- driver.expects(:create).
501
- with { |state| state[:last_action] == "create" }
480
+ driver.expects(:create)
481
+ .with { |state| state[:last_action] == "create" }
502
482
 
503
483
  instance.create
504
484
  end
@@ -512,13 +492,11 @@ describe Kitchen::Instance do
512
492
  end
513
493
 
514
494
  describe "#converge" do
515
-
516
495
  describe "with no state" do
517
-
518
496
  it "calls Driver#create and Provisioner#call with empty state hash" do
519
- driver.expects(:create).with(Hash.new)
520
- provisioner.expects(:call).
521
- with { |state| state[:last_action] == "create" }
497
+ driver.expects(:create).with({})
498
+ provisioner.expects(:call)
499
+ .with { |state| state[:last_action] == "create" }
522
500
 
523
501
  instance.converge
524
502
  end
@@ -538,18 +516,17 @@ describe Kitchen::Instance do
538
516
  it "logs the action finish" do
539
517
  instance.converge
540
518
 
541
- logger_io.string.
542
- must_match regex_for("Finished converging #{instance.to_str}")
519
+ logger_io.string
520
+ .must_match regex_for("Finished converging #{instance.to_str}")
543
521
  end
544
522
  end
545
523
 
546
524
  describe "with last action of create" do
547
-
548
- before { state_file.write(:last_action => "create") }
525
+ before { state_file.write(last_action: "create") }
549
526
 
550
527
  it "calls Provisioner#call with state hash" do
551
- provisioner.expects(:call).
552
- with { |state| state[:last_action] == "create" }
528
+ provisioner.expects(:call)
529
+ .with { |state| state[:last_action] == "create" }
553
530
 
554
531
  instance.converge
555
532
  end
@@ -562,12 +539,11 @@ describe Kitchen::Instance do
562
539
  end
563
540
 
564
541
  describe "with last action of converge" do
565
-
566
- before { state_file.write(:last_action => "converge") }
542
+ before { state_file.write(last_action: "converge") }
567
543
 
568
544
  it "calls Provisioner#call with state hash" do
569
- provisioner.expects(:call).
570
- with { |state| state[:last_action] == "converge" }
545
+ provisioner.expects(:call)
546
+ .with { |state| state[:last_action] == "converge" }
571
547
 
572
548
  instance.converge
573
549
  end
@@ -581,16 +557,14 @@ describe Kitchen::Instance do
581
557
  end
582
558
 
583
559
  describe "#setup" do
584
-
585
560
  describe "with no state" do
586
-
587
561
  it "calls create and converge with empty state hash" do
588
- driver.expects(:create).with(Hash.new)
589
- provisioner.expects(:call).
590
- with { |state| state[:last_action] == "create" }
591
- driver.expects(:setup).
592
- with { |state| state[:last_action] == "converge" }.
593
- never
562
+ driver.expects(:create).with({})
563
+ provisioner.expects(:call)
564
+ .with { |state| state[:last_action] == "create" }
565
+ driver.expects(:setup)
566
+ .with { |state| state[:last_action] == "converge" }
567
+ .never
594
568
 
595
569
  instance.setup
596
570
  end
@@ -610,21 +584,20 @@ describe Kitchen::Instance do
610
584
  it "logs the action finish" do
611
585
  instance.setup
612
586
 
613
- logger_io.string.
614
- must_match regex_for("Finished setting up #{instance.to_str}")
587
+ logger_io.string
588
+ .must_match regex_for("Finished setting up #{instance.to_str}")
615
589
  end
616
590
  end
617
591
 
618
592
  describe "with last action of create" do
619
-
620
- before { state_file.write(:last_action => "create") }
593
+ before { state_file.write(last_action: "create") }
621
594
 
622
595
  it "calls Provisioner#call with state hash" do
623
- provisioner.expects(:call).
624
- with { |state| state[:last_action] == "create" }
625
- driver.expects(:setup).
626
- with { |state| state[:last_action] == "converge" }.
627
- never
596
+ provisioner.expects(:call)
597
+ .with { |state| state[:last_action] == "create" }
598
+ driver.expects(:setup)
599
+ .with { |state| state[:last_action] == "converge" }
600
+ .never
628
601
 
629
602
  instance.setup
630
603
  end
@@ -637,13 +610,12 @@ describe Kitchen::Instance do
637
610
  end
638
611
 
639
612
  describe "with last action of converge" do
640
-
641
- before { state_file.write(:last_action => "converge") }
613
+ before { state_file.write(last_action: "converge") }
642
614
 
643
615
  it "calls nothing with state hash" do
644
- driver.expects(:setup).
645
- with { |state| state[:last_action] == "converge" }.
646
- never
616
+ driver.expects(:setup)
617
+ .with { |state| state[:last_action] == "converge" }
618
+ .never
647
619
 
648
620
  instance.setup
649
621
  end
@@ -656,13 +628,12 @@ describe Kitchen::Instance do
656
628
  end
657
629
 
658
630
  describe "with last action of setup" do
659
-
660
- before { state_file.write(:last_action => "setup") }
631
+ before { state_file.write(last_action: "setup") }
661
632
 
662
633
  it "calls nothing with state hash" do
663
- driver.expects(:setup).
664
- with { |state| state[:last_action] == "setup" }.
665
- never
634
+ driver.expects(:setup)
635
+ .with { |state| state[:last_action] == "setup" }
636
+ .never
666
637
 
667
638
  instance.setup
668
639
  end
@@ -676,18 +647,16 @@ describe Kitchen::Instance do
676
647
  end
677
648
 
678
649
  describe "#verify" do
679
-
680
650
  describe "with no state" do
681
-
682
651
  it "calls create, converge, and verify with empty state hash" do
683
- driver.expects(:create).with(Hash.new)
684
- provisioner.expects(:call).
685
- with { |state| state[:last_action] == "create" }
686
- driver.expects(:setup).
687
- with { |state| state[:last_action] == "converge" }.
688
- never
689
- verifier.expects(:call).
690
- with { |state| state[:last_action] == "setup" }
652
+ driver.expects(:create).with({})
653
+ provisioner.expects(:call)
654
+ .with { |state| state[:last_action] == "create" }
655
+ driver.expects(:setup)
656
+ .with { |state| state[:last_action] == "converge" }
657
+ .never
658
+ verifier.expects(:call)
659
+ .with { |state| state[:last_action] == "setup" }
691
660
 
692
661
  instance.verify
693
662
  end
@@ -707,23 +676,22 @@ describe Kitchen::Instance do
707
676
  it "logs the action finish" do
708
677
  instance.verify
709
678
 
710
- logger_io.string.
711
- must_match regex_for("Finished verifying #{instance.to_str}")
679
+ logger_io.string
680
+ .must_match regex_for("Finished verifying #{instance.to_str}")
712
681
  end
713
682
  end
714
683
 
715
684
  describe "with last of create" do
716
-
717
- before { state_file.write(:last_action => "create") }
685
+ before { state_file.write(last_action: "create") }
718
686
 
719
687
  it "calls converge, and verify with state hash" do
720
- provisioner.expects(:call).
721
- with { |state| state[:last_action] == "create" }
722
- driver.expects(:setup).
723
- with { |state| state[:last_action] == "converge" }.
724
- never
725
- verifier.expects(:call).
726
- with { |state| state[:last_action] == "setup" }
688
+ provisioner.expects(:call)
689
+ .with { |state| state[:last_action] == "create" }
690
+ driver.expects(:setup)
691
+ .with { |state| state[:last_action] == "converge" }
692
+ .never
693
+ verifier.expects(:call)
694
+ .with { |state| state[:last_action] == "setup" }
727
695
 
728
696
  instance.verify
729
697
  end
@@ -736,15 +704,14 @@ describe Kitchen::Instance do
736
704
  end
737
705
 
738
706
  describe "with last of converge" do
739
-
740
- before { state_file.write(:last_action => "converge") }
707
+ before { state_file.write(last_action: "converge") }
741
708
 
742
709
  it "calls Verifier#call with state hash" do
743
- driver.expects(:setup).
744
- with { |state| state[:last_action] == "converge" }.
745
- never
746
- verifier.expects(:call).
747
- with { |state| state[:last_action] == "setup" }
710
+ driver.expects(:setup)
711
+ .with { |state| state[:last_action] == "converge" }
712
+ .never
713
+ verifier.expects(:call)
714
+ .with { |state| state[:last_action] == "setup" }
748
715
 
749
716
  instance.verify
750
717
  end
@@ -757,12 +724,11 @@ describe Kitchen::Instance do
757
724
  end
758
725
 
759
726
  describe "with last of setup" do
760
-
761
- before { state_file.write(:last_action => "setup") }
727
+ before { state_file.write(last_action: "setup") }
762
728
 
763
729
  it "calls Verifier#call with state hash" do
764
- verifier.expects(:call).
765
- with { |state| state[:last_action] == "setup" }
730
+ verifier.expects(:call)
731
+ .with { |state| state[:last_action] == "setup" }
766
732
 
767
733
  instance.verify
768
734
  end
@@ -775,12 +741,11 @@ describe Kitchen::Instance do
775
741
  end
776
742
 
777
743
  describe "with last of verify" do
778
-
779
- before { state_file.write(:last_action => "verify") }
744
+ before { state_file.write(last_action: "verify") }
780
745
 
781
746
  it "calls Verifier#call with state hash" do
782
- verifier.expects(:call).
783
- with { |state| state[:last_action] == "verify" }
747
+ verifier.expects(:call)
748
+ .with { |state| state[:last_action] == "verify" }
784
749
 
785
750
  instance.verify
786
751
  end
@@ -794,11 +759,9 @@ describe Kitchen::Instance do
794
759
  end
795
760
 
796
761
  describe "#destroy" do
797
-
798
762
  describe "with no state" do
799
-
800
763
  it "calls Driver#destroy with empty state hash" do
801
- driver.expects(:destroy).with(Hash.new)
764
+ driver.expects(:destroy).with({})
802
765
 
803
766
  instance.destroy
804
767
  end
@@ -812,27 +775,25 @@ describe Kitchen::Instance do
812
775
  it "logs the action start" do
813
776
  instance.destroy
814
777
 
815
- logger_io.string.
816
- must_match regex_for("Destroying #{instance.to_str}")
778
+ logger_io.string
779
+ .must_match regex_for("Destroying #{instance.to_str}")
817
780
  end
818
781
 
819
782
  it "logs the create finish" do
820
783
  instance.destroy
821
784
 
822
- logger_io.string.
823
- must_match regex_for("Finished destroying #{instance.to_str}")
785
+ logger_io.string
786
+ .must_match regex_for("Finished destroying #{instance.to_str}")
824
787
  end
825
788
  end
826
789
 
827
790
  [:create, :converge, :setup, :verify].each do |action|
828
-
829
791
  describe "with last_action of #{action}" do
830
-
831
- before { state_file.write(:last_action => action) }
792
+ before { state_file.write(last_action: action) }
832
793
 
833
794
  it "calls Driver#create with state hash" do
834
- driver.expects(:destroy).
835
- with { |state| state[:last_action] == action }
795
+ driver.expects(:destroy)
796
+ .with { |state| state[:last_action] == action }
836
797
 
837
798
  instance.destroy
838
799
  end
@@ -847,9 +808,7 @@ describe Kitchen::Instance do
847
808
  end
848
809
 
849
810
  describe "#test" do
850
-
851
811
  describe "with no state" do
852
-
853
812
  it "calls destroy, create, converge, setup, verify, destroy" do
854
813
  driver.expects(:destroy)
855
814
  driver.expects(:create)
@@ -869,16 +828,14 @@ describe Kitchen::Instance do
869
828
  it "logs the action finish" do
870
829
  instance.test
871
830
 
872
- logger_io.string.
873
- must_match regex_for("Finished testing #{instance.to_str}")
831
+ logger_io.string
832
+ .must_match regex_for("Finished testing #{instance.to_str}")
874
833
  end
875
834
  end
876
835
 
877
836
  [:create, :converge, :setup, :verify].each do |action|
878
-
879
837
  describe "with last action of #{action}" do
880
-
881
- before { state_file.write(:last_action => action) }
838
+ before { state_file.write(last_action: action) }
882
839
 
883
840
  it "calls destroy, create, converge, setup, verify, destroy" do
884
841
  driver.expects(:destroy)
@@ -893,7 +850,6 @@ describe Kitchen::Instance do
893
850
  end
894
851
 
895
852
  describe "with destroy mode of never" do
896
-
897
853
  it "calls destroy, create, converge, setup, verify" do
898
854
  driver.expects(:destroy).once
899
855
  driver.expects(:create)
@@ -905,7 +861,6 @@ describe Kitchen::Instance do
905
861
  end
906
862
 
907
863
  describe "with destroy mode of always" do
908
-
909
864
  it "calls destroy at even when action fails" do
910
865
  driver.expects(:destroy)
911
866
  driver.expects(:create)
@@ -920,7 +875,6 @@ describe Kitchen::Instance do
920
875
  end
921
876
 
922
877
  describe "with destroy mode of passing" do
923
-
924
878
  it "doesn't call Driver#destroy at when action fails" do
925
879
  driver.stubs(:create).raises(Kitchen::ActionFailed)
926
880
 
@@ -935,8 +889,7 @@ describe Kitchen::Instance do
935
889
  end
936
890
 
937
891
  describe "#remote_exec" do
938
-
939
- before { state_file.write(:last_action => "create") }
892
+ before { state_file.write(last_action: "create") }
940
893
 
941
894
  it "calls Transport#execute with command" do
942
895
  connection = mock("connection")
@@ -948,9 +901,7 @@ describe Kitchen::Instance do
948
901
  end
949
902
 
950
903
  [:create, :converge, :setup, :verify, :test].each do |action|
951
-
952
904
  describe "#{action} on driver crash with ActionFailed" do
953
-
954
905
  before do
955
906
  driver.stubs(:create).raises(Kitchen::ActionFailed, "death")
956
907
  end
@@ -966,8 +917,8 @@ describe Kitchen::Instance do
966
917
  end
967
918
 
968
919
  it "raises an InstanceFailure" do
969
- proc { instance.public_send(action) }.
970
- must_raise Kitchen::InstanceFailure
920
+ proc { instance.public_send(action) }
921
+ .must_raise Kitchen::InstanceFailure
971
922
  end
972
923
 
973
924
  it "populates the InstanceFailure message" do
@@ -992,7 +943,6 @@ describe Kitchen::Instance do
992
943
  end
993
944
 
994
945
  describe "on driver crash with unexpected exception class" do
995
-
996
946
  before do
997
947
  driver.stubs(:create).raises(RuntimeError, "watwat")
998
948
  end
@@ -1008,8 +958,8 @@ describe Kitchen::Instance do
1008
958
  end
1009
959
 
1010
960
  it "raises an ActionFailed" do
1011
- proc { instance.public_send(action) }.
1012
- must_raise Kitchen::ActionFailed
961
+ proc { instance.public_send(action) }
962
+ .must_raise Kitchen::ActionFailed
1013
963
  end
1014
964
 
1015
965
  it "populates the ActionFailed message" do
@@ -1035,15 +985,13 @@ describe Kitchen::Instance do
1035
985
  end
1036
986
 
1037
987
  describe "crashes preserve last action for desired verify action" do
1038
-
1039
988
  before do
1040
989
  verifier.stubs(:call).raises(Kitchen::ActionFailed, "death")
1041
990
  end
1042
991
 
1043
992
  [:create, :converge, :setup].each do |action|
1044
-
1045
993
  it "for last state #{action}" do
1046
- state_file.write(:last_action => action.to_s)
994
+ state_file.write(last_action: action.to_s)
1047
995
  begin
1048
996
  instance.verify
1049
997
  rescue Kitchen::Error
@@ -1055,7 +1003,7 @@ describe Kitchen::Instance do
1055
1003
  end
1056
1004
 
1057
1005
  it "for last state verify" do
1058
- state_file.write(:last_action => "verify")
1006
+ state_file.write(last_action: "verify")
1059
1007
  begin
1060
1008
  instance.verify
1061
1009
  rescue Kitchen::Error
@@ -1067,7 +1015,6 @@ describe Kitchen::Instance do
1067
1015
  end
1068
1016
 
1069
1017
  describe "on drivers with serial actions" do
1070
-
1071
1018
  let(:driver) { SerialDummyDriver.new({}) }
1072
1019
 
1073
1020
  it "runs in a synchronized block for serial actions" do
@@ -1079,41 +1026,36 @@ describe Kitchen::Instance do
1079
1026
  end
1080
1027
 
1081
1028
  describe "with legacy Driver::SSHBase subclasses" do
1082
-
1083
1029
  let(:driver) { LegacyDriver.new({}) }
1084
1030
 
1085
1031
  describe "#converge" do
1086
-
1087
1032
  describe "with no state" do
1088
-
1089
1033
  it "calls Driver#create and Driver#converge with empty state hash" do
1090
- driver.expects(:create).with(Hash.new)
1091
- driver.expects(:converge).
1092
- with { |state| state[:last_action] == "create" }
1034
+ driver.expects(:create).with({})
1035
+ driver.expects(:converge)
1036
+ .with { |state| state[:last_action] == "create" }
1093
1037
 
1094
1038
  instance.converge
1095
1039
  end
1096
1040
  end
1097
1041
 
1098
1042
  describe "with last action of create" do
1099
-
1100
- before { state_file.write(:last_action => "create") }
1043
+ before { state_file.write(last_action: "create") }
1101
1044
 
1102
1045
  it "calls Driver#converge with state hash" do
1103
- driver.expects(:converge).
1104
- with { |state| state[:last_action] == "create" }
1046
+ driver.expects(:converge)
1047
+ .with { |state| state[:last_action] == "create" }
1105
1048
 
1106
1049
  instance.converge
1107
1050
  end
1108
1051
  end
1109
1052
 
1110
1053
  describe "with last action of converge" do
1111
-
1112
- before { state_file.write(:last_action => "converge") }
1054
+ before { state_file.write(last_action: "converge") }
1113
1055
 
1114
1056
  it "calls Driver#converge with state hash" do
1115
- driver.expects(:converge).
1116
- with { |state| state[:last_action] == "converge" }
1057
+ driver.expects(:converge)
1058
+ .with { |state| state[:last_action] == "converge" }
1117
1059
 
1118
1060
  instance.converge
1119
1061
  end
@@ -1121,53 +1063,48 @@ describe Kitchen::Instance do
1121
1063
  end
1122
1064
 
1123
1065
  describe "#setup" do
1124
-
1125
1066
  describe "with no state" do
1126
-
1127
1067
  it "calls create, converge, and setup with empty state hash" do
1128
- driver.expects(:create).with(Hash.new)
1129
- driver.expects(:converge).
1130
- with { |state| state[:last_action] == "create" }
1131
- driver.expects(:setup).
1132
- with { |state| state[:last_action] == "converge" }
1068
+ driver.expects(:create).with({})
1069
+ driver.expects(:converge)
1070
+ .with { |state| state[:last_action] == "create" }
1071
+ driver.expects(:setup)
1072
+ .with { |state| state[:last_action] == "converge" }
1133
1073
 
1134
1074
  instance.setup
1135
1075
  end
1136
1076
  end
1137
1077
 
1138
1078
  describe "with last action of create" do
1139
-
1140
- before { state_file.write(:last_action => "create") }
1079
+ before { state_file.write(last_action: "create") }
1141
1080
 
1142
1081
  it "calls Provisioner#call and setup with state hash" do
1143
- driver.expects(:converge).
1144
- with { |state| state[:last_action] == "create" }
1145
- driver.expects(:setup).
1146
- with { |state| state[:last_action] == "converge" }
1082
+ driver.expects(:converge)
1083
+ .with { |state| state[:last_action] == "create" }
1084
+ driver.expects(:setup)
1085
+ .with { |state| state[:last_action] == "converge" }
1147
1086
 
1148
1087
  instance.setup
1149
1088
  end
1150
1089
  end
1151
1090
 
1152
1091
  describe "with last action of converge" do
1153
-
1154
- before { state_file.write(:last_action => "converge") }
1092
+ before { state_file.write(last_action: "converge") }
1155
1093
 
1156
1094
  it "calls Driver#setup with state hash" do
1157
- driver.expects(:setup).
1158
- with { |state| state[:last_action] == "converge" }
1095
+ driver.expects(:setup)
1096
+ .with { |state| state[:last_action] == "converge" }
1159
1097
 
1160
1098
  instance.setup
1161
1099
  end
1162
1100
  end
1163
1101
 
1164
1102
  describe "with last action of setup" do
1165
-
1166
- before { state_file.write(:last_action => "setup") }
1103
+ before { state_file.write(last_action: "setup") }
1167
1104
 
1168
1105
  it "calls Driver#setup with state hash" do
1169
- driver.expects(:setup).
1170
- with { |state| state[:last_action] == "setup" }
1106
+ driver.expects(:setup)
1107
+ .with { |state| state[:last_action] == "setup" }
1171
1108
 
1172
1109
  instance.setup
1173
1110
  end
@@ -1175,71 +1112,65 @@ describe Kitchen::Instance do
1175
1112
  end
1176
1113
 
1177
1114
  describe "#verify" do
1178
-
1179
1115
  describe "with no state" do
1180
-
1181
1116
  it "calls create, converge, setup, and verify with empty state hash" do
1182
- driver.expects(:create).with(Hash.new)
1183
- driver.expects(:converge).
1184
- with { |state| state[:last_action] == "create" }
1185
- driver.expects(:setup).
1186
- with { |state| state[:last_action] == "converge" }
1187
- driver.expects(:verify).
1188
- with { |state| state[:last_action] == "setup" }
1117
+ driver.expects(:create).with({})
1118
+ driver.expects(:converge)
1119
+ .with { |state| state[:last_action] == "create" }
1120
+ driver.expects(:setup)
1121
+ .with { |state| state[:last_action] == "converge" }
1122
+ driver.expects(:verify)
1123
+ .with { |state| state[:last_action] == "setup" }
1189
1124
 
1190
1125
  instance.verify
1191
1126
  end
1192
1127
  end
1193
1128
 
1194
1129
  describe "with last of create" do
1195
-
1196
- before { state_file.write(:last_action => "create") }
1130
+ before { state_file.write(last_action: "create") }
1197
1131
 
1198
1132
  it "calls converge, setup, and verify with state hash" do
1199
- driver.expects(:converge).
1200
- with { |state| state[:last_action] == "create" }
1201
- driver.expects(:setup).
1202
- with { |state| state[:last_action] == "converge" }
1203
- driver.expects(:verify).
1204
- with { |state| state[:last_action] == "setup" }
1133
+ driver.expects(:converge)
1134
+ .with { |state| state[:last_action] == "create" }
1135
+ driver.expects(:setup)
1136
+ .with { |state| state[:last_action] == "converge" }
1137
+ driver.expects(:verify)
1138
+ .with { |state| state[:last_action] == "setup" }
1205
1139
 
1206
1140
  instance.verify
1207
1141
  end
1208
1142
  end
1209
1143
 
1210
1144
  describe "with last of converge" do
1211
-
1212
- before { state_file.write(:last_action => "converge") }
1145
+ before { state_file.write(last_action: "converge") }
1213
1146
 
1214
1147
  it "calls Driver#setup, and verify with state hash" do
1215
- driver.expects(:setup).
1216
- with { |state| state[:last_action] == "converge" }
1217
- driver.expects(:verify).
1218
- with { |state| state[:last_action] == "setup" }
1148
+ driver.expects(:setup)
1149
+ .with { |state| state[:last_action] == "converge" }
1150
+ driver.expects(:verify)
1151
+ .with { |state| state[:last_action] == "setup" }
1219
1152
 
1220
1153
  instance.verify
1221
1154
  end
1222
1155
  end
1223
1156
 
1224
1157
  describe "with last of setup" do
1225
-
1226
- before { state_file.write(:last_action => "setup") }
1158
+ before { state_file.write(last_action: "setup") }
1227
1159
 
1228
1160
  it "calls Driver#verify with state hash" do
1229
- driver.expects(:verify).
1230
- with { |state| state[:last_action] == "setup" }
1161
+ driver.expects(:verify)
1162
+ .with { |state| state[:last_action] == "setup" }
1231
1163
 
1232
1164
  instance.verify
1233
1165
  end
1234
1166
  end
1235
1167
 
1236
1168
  describe "with last of verify" do
1237
-
1238
- before { state_file.write(:last_action => "verify") }
1169
+ before { state_file.write(last_action: "verify") }
1239
1170
 
1240
1171
  it "calls Driver#verify with state hash" do
1241
- driver.expects(:verify).
1242
- with { |state| state[:last_action] == "verify" }
1172
+ driver.expects(:verify)
1173
+ .with { |state| state[:last_action] == "verify" }
1243
1174
 
1244
1175
  instance.verify
1245
1176
  end
@@ -1247,9 +1178,7 @@ describe Kitchen::Instance do
1247
1178
  end
1248
1179
 
1249
1180
  describe "#test" do
1250
-
1251
1181
  describe "with no state" do
1252
-
1253
1182
  it "calls destroy, create, converge, setup, verify, destroy" do
1254
1183
  driver.expects(:destroy)
1255
1184
  driver.expects(:create)
@@ -1263,10 +1192,8 @@ describe Kitchen::Instance do
1263
1192
  end
1264
1193
 
1265
1194
  [:create, :converge, :setup, :verify].each do |action|
1266
-
1267
1195
  describe "with last action of #{action}" do
1268
-
1269
- before { state_file.write(:last_action => action) }
1196
+ before { state_file.write(last_action: action) }
1270
1197
 
1271
1198
  it "calls destroy, create, converge, setup, verify, destroy" do
1272
1199
  driver.expects(:destroy)
@@ -1282,7 +1209,6 @@ describe Kitchen::Instance do
1282
1209
  end
1283
1210
 
1284
1211
  describe "with destroy mode of never" do
1285
-
1286
1212
  it "calls destroy, create, converge, setup, verify" do
1287
1213
  driver.expects(:destroy).once
1288
1214
  driver.expects(:create)
@@ -1295,7 +1221,6 @@ describe Kitchen::Instance do
1295
1221
  end
1296
1222
 
1297
1223
  describe "with destroy mode of always" do
1298
-
1299
1224
  it "calls destroy at even when action fails" do
1300
1225
  driver.expects(:destroy)
1301
1226
  driver.expects(:create)
@@ -1311,10 +1236,10 @@ describe Kitchen::Instance do
1311
1236
  end
1312
1237
 
1313
1238
  it "#login executes the driver's login_command" do
1314
- state_file.write(:last_action => "create")
1315
- driver.stubs(:login_command).with(:last_action => "create").
1316
- returns(Kitchen::LoginCommand.new("echo", ["hello"], :purple => true))
1317
- Kernel.expects(:exec).with("echo", "hello", :purple => true)
1239
+ state_file.write(last_action: "create")
1240
+ driver.stubs(:login_command).with(last_action: "create")
1241
+ .returns(Kitchen::LoginCommand.new("echo", ["hello"], purple: true))
1242
+ Kernel.expects(:exec).with("echo", "hello", purple: true)
1318
1243
 
1319
1244
  instance.login
1320
1245
  end
@@ -1322,11 +1247,9 @@ describe Kitchen::Instance do
1322
1247
  end
1323
1248
 
1324
1249
  describe Kitchen::Instance::FSM do
1325
-
1326
1250
  let(:fsm) { Kitchen::Instance::FSM }
1327
1251
 
1328
1252
  describe ".actions" do
1329
-
1330
1253
  it "passing nils returns destroy" do
1331
1254
  fsm.actions(nil, nil).must_equal [:destroy]
1332
1255
  end