test-kitchen 1.14.1 → 1.14.2

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.
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
@@ -21,33 +21,32 @@ require_relative "../spec_helper"
21
21
  require "kitchen/diagnostic"
22
22
 
23
23
  describe Kitchen::Diagnostic do
24
-
25
24
  let(:loader) do
26
- stub(:diagnose => { :who => "loader" })
25
+ stub(diagnose: { who: "loader" })
27
26
  end
28
27
 
29
28
  let(:instances) do
30
29
  [
31
30
  stub(
32
- :name => "i1",
33
- :diagnose => { :stuff => "sup" },
34
- :diagnose_plugins => {
35
- :driver => { :name => "driva", :a => "b" },
36
- :provisioner => { :name => "prov", :c => "d" },
37
- :transport => { :name => "transa", :e => "f" },
38
- :verifier => { :name => "verve", :g => "h" }
31
+ name: "i1",
32
+ diagnose: { stuff: "sup" },
33
+ diagnose_plugins: {
34
+ driver: { name: "driva", a: "b" },
35
+ provisioner: { name: "prov", c: "d" },
36
+ transport: { name: "transa", e: "f" },
37
+ verifier: { name: "verve", g: "h" },
39
38
  }
40
39
  ),
41
40
  stub(
42
- :name => "i2",
43
- :diagnose => { :stuff => "yo" },
44
- :diagnose_plugins => {
45
- :driver => { :name => "driva", :a => "b" },
46
- :provisioner => { :name => "presto", :i => "j" },
47
- :transport => { :name => "tressa", :k => "l" },
48
- :verifier => { :name => "verve", :g => "h" }
41
+ name: "i2",
42
+ diagnose: { stuff: "yo" },
43
+ diagnose_plugins: {
44
+ driver: { name: "driva", a: "b" },
45
+ provisioner: { name: "presto", i: "j" },
46
+ transport: { name: "tressa", k: "l" },
47
+ verifier: { name: "verve", g: "h" },
49
48
  }
50
- )
49
+ ),
51
50
  ]
52
51
  end
53
52
 
@@ -62,8 +61,8 @@ describe Kitchen::Diagnostic do
62
61
  it "#read returns a timestamp in UTC" do
63
62
  Time.stubs(:now).returns(Time.at(0))
64
63
 
65
- Kitchen::Diagnostic.new.read["timestamp"].
66
- must_equal "1970-01-01 00:00:00 UTC"
64
+ Kitchen::Diagnostic.new.read["timestamp"]
65
+ .must_equal "1970-01-01 00:00:00 UTC"
67
66
  end
68
67
 
69
68
  it "#read doesn't return a loader hash if not given one" do
@@ -71,39 +70,39 @@ describe Kitchen::Diagnostic do
71
70
  end
72
71
 
73
72
  it "#read returns the loader's diganose hash if a loader is present" do
74
- Kitchen::Diagnostic.new(:loader => loader).
75
- read["loader"].must_equal("who" => "loader")
73
+ Kitchen::Diagnostic.new(loader: loader)
74
+ .read["loader"].must_equal("who" => "loader")
76
75
  end
77
76
 
78
77
  it "#read returns an error hash for loader if error hash is passed in" do
79
- Kitchen::Diagnostic.new(:loader => { :error => "damn" }).
80
- read["loader"].must_equal("error" => "damn")
78
+ Kitchen::Diagnostic.new(loader: { error: "damn" })
79
+ .read["loader"].must_equal("error" => "damn")
81
80
  end
82
81
 
83
82
  it "#read returns the unique set of plugins' diagnose hash if :plugins is set" do
84
- Kitchen::Diagnostic.new(:instances => instances, :plugins => true).
85
- read["plugins"].
86
- must_equal(
83
+ Kitchen::Diagnostic.new(instances: instances, plugins: true)
84
+ .read["plugins"]
85
+ .must_equal(
87
86
  "driver" => {
88
- "driva" => { "a" => "b" }
87
+ "driva" => { "a" => "b" },
89
88
  },
90
89
  "provisioner" => {
91
90
  "prov" => { "c" => "d" },
92
- "presto" => { "i" => "j" }
91
+ "presto" => { "i" => "j" },
93
92
  },
94
93
  "transport" => {
95
94
  "transa" => { "e" => "f" },
96
- "tressa" => { "k" => "l" }
95
+ "tressa" => { "k" => "l" },
97
96
  },
98
97
  "verifier" => {
99
- "verve" => { "g" => "h" }
98
+ "verve" => { "g" => "h" },
100
99
  }
101
100
  )
102
101
  end
103
102
 
104
103
  it "#read returns an empty plugins hash if no instances were given" do
105
- Kitchen::Diagnostic.new(:plugins => true).
106
- read["plugins"].must_equal Hash.new
104
+ Kitchen::Diagnostic.new(plugins: true)
105
+ .read["plugins"].must_equal Hash.new
107
106
  end
108
107
 
109
108
  it "#read returns an empty instances hash if no instances were given" do
@@ -112,18 +111,18 @@ describe Kitchen::Diagnostic do
112
111
 
113
112
  it "#read returns an error hash for plugins if error hash is passed in" do
114
113
  Kitchen::Diagnostic.new(
115
- :instances => { :error => "shoot" }, :plugins => true
114
+ instances: { error: "shoot" }, plugins: true
116
115
  ).read["plugins"].must_equal("error" => "shoot")
117
116
  end
118
117
 
119
118
  it "#read returns the instances' diganose hashes if instances are present" do
120
- Kitchen::Diagnostic.new(:instances => instances).
121
- read["instances"].
122
- must_equal("i1" => { "stuff" => "sup" }, "i2" => { "stuff" => "yo" })
119
+ Kitchen::Diagnostic.new(instances: instances)
120
+ .read["instances"]
121
+ .must_equal("i1" => { "stuff" => "sup" }, "i2" => { "stuff" => "yo" })
123
122
  end
124
123
 
125
124
  it "#read returns an error hash for instances if error hash is passed in" do
126
- Kitchen::Diagnostic.new(:instances => { :error => "shoot" }).
127
- read["instances"].must_equal("error" => "shoot")
125
+ Kitchen::Diagnostic.new(instances: { error: "shoot" })
126
+ .read["instances"].must_equal("error" => "shoot")
128
127
  end
129
128
  end
@@ -23,19 +23,15 @@ require "stringio"
23
23
  require "kitchen"
24
24
 
25
25
  module Kitchen
26
-
27
26
  module Driver
28
-
29
27
  class Speedy < Base
30
28
  end
31
29
 
32
30
  class Dodgy < Base
33
-
34
31
  no_parallel_for :setup
35
32
  end
36
33
 
37
34
  class Slow < Base
38
-
39
35
  no_parallel_for :create, :destroy
40
36
  no_parallel_for :verify
41
37
  end
@@ -43,22 +39,21 @@ module Kitchen
43
39
  end
44
40
 
45
41
  describe Kitchen::Driver::Base do
46
-
47
42
  let(:logged_output) { StringIO.new }
48
43
  let(:logger) { Logger.new(logged_output) }
49
44
  let(:config) { Hash.new }
50
45
  let(:state) { Hash.new }
51
46
 
52
47
  let(:busser) do
53
- stub(:setup_cmd => "setup", :sync_cmd => "sync", :run_cmd => "run")
48
+ stub(setup_cmd: "setup", sync_cmd: "sync", run_cmd: "run")
54
49
  end
55
50
 
56
51
  let(:instance) do
57
52
  stub(
58
- :name => "coolbeans",
59
- :logger => logger,
60
- :busser => busser,
61
- :to_str => "instance"
53
+ name: "coolbeans",
54
+ logger: logger,
55
+ busser: busser,
56
+ to_str: "instance"
62
57
  )
63
58
  end
64
59
 
@@ -85,7 +80,6 @@ describe Kitchen::Driver::Base do
85
80
  end
86
81
 
87
82
  [:create, :setup, :verify, :destroy].each do |action|
88
-
89
83
  it "has a #{action} method that takes state" do
90
84
  # TODO: revert back
91
85
  # state = Hash.new
@@ -95,7 +89,6 @@ describe Kitchen::Driver::Base do
95
89
  end
96
90
 
97
91
  describe ".no_parallel_for" do
98
-
99
92
  it "registers no serial actions when none are declared" do
100
93
  Kitchen::Driver::Speedy.serial_actions.must_equal nil
101
94
  end
@@ -113,9 +106,9 @@ describe Kitchen::Driver::Base do
113
106
  end
114
107
 
115
108
  it "raises a ClientError if value is not an action method" do
116
- proc {
109
+ proc do
117
110
  Class.new(Kitchen::Driver::Base) { no_parallel_for :telling_stories }
118
- }.must_raise Kitchen::ClientError
111
+ end.must_raise Kitchen::ClientError
119
112
  end
120
113
  end
121
114
  end
@@ -23,14 +23,13 @@ require "stringio"
23
23
  require "kitchen/driver/dummy"
24
24
 
25
25
  describe Kitchen::Driver::Dummy do
26
-
27
26
  let(:logged_output) { StringIO.new }
28
27
  let(:logger) { Logger.new(logged_output) }
29
28
  let(:config) { Hash.new }
30
29
  let(:state) { Hash.new }
31
30
 
32
31
  let(:instance) do
33
- stub(:name => "coolbeans", :logger => logger, :to_str => "instance")
32
+ stub(name: "coolbeans", logger: logger, to_str: "instance")
34
33
  end
35
34
 
36
35
  let(:driver) do
@@ -46,7 +45,6 @@ describe Kitchen::Driver::Dummy do
46
45
  end
47
46
 
48
47
  describe "default_config" do
49
-
50
48
  it "sets :sleep to 0 by default" do
51
49
  driver[:sleep].must_equal 0
52
50
  end
@@ -57,7 +55,6 @@ describe Kitchen::Driver::Dummy do
57
55
  end
58
56
 
59
57
  describe "#create" do
60
-
61
58
  it "sets :my_id to a unique value as an example" do
62
59
  driver.create(state)
63
60
 
@@ -104,7 +101,6 @@ describe Kitchen::Driver::Dummy do
104
101
  end
105
102
 
106
103
  describe "#setup" do
107
-
108
104
  it "calls sleep if :sleep value is greater than 0" do
109
105
  config[:sleep] = 12.5
110
106
  driver.expects(:sleep).with(12.5).returns(true)
@@ -133,7 +129,6 @@ describe Kitchen::Driver::Dummy do
133
129
  end
134
130
 
135
131
  describe "#verify" do
136
-
137
132
  it "calls sleep if :sleep value is greater than 0" do
138
133
  config[:sleep] = 12.5
139
134
  driver.expects(:sleep).with(12.5).returns(true)
@@ -162,7 +157,6 @@ describe Kitchen::Driver::Dummy do
162
157
  end
163
158
 
164
159
  describe "#destroy" do
165
-
166
160
  it "removes :my_id from the state hash" do
167
161
  state[:my_id] = "90210"
168
162
  driver.destroy(state)
@@ -21,17 +21,16 @@ require_relative "../../spec_helper"
21
21
  require "kitchen/driver/proxy"
22
22
 
23
23
  describe Kitchen::Driver::Proxy do
24
-
25
24
  let(:logged_output) { StringIO.new }
26
25
  let(:logger) { Logger.new(logged_output) }
27
26
  let(:state) { Hash.new }
28
27
 
29
28
  let(:config) do
30
- { :host => "foobnoobs.com", :reset_command => "mulligan" }
29
+ { host: "foobnoobs.com", reset_command: "mulligan" }
31
30
  end
32
31
 
33
32
  let(:instance) do
34
- stub(:name => "coolbeans", :logger => logger, :to_str => "instance")
33
+ stub(name: "coolbeans", logger: logger, to_str: "instance")
35
34
  end
36
35
 
37
36
  let(:driver) do
@@ -43,7 +42,6 @@ describe Kitchen::Driver::Proxy do
43
42
  end
44
43
 
45
44
  describe "non-parallel action" do
46
-
47
45
  it "create must be serially executed" do
48
46
  Kitchen::Driver::Proxy.serial_actions.must_include :create
49
47
  end
@@ -54,7 +52,6 @@ describe Kitchen::Driver::Proxy do
54
52
  end
55
53
 
56
54
  describe "required_config" do
57
-
58
55
  [:host, :reset_command].each do |attr|
59
56
  it "requires :#{attr}" do
60
57
  config.delete(attr)
@@ -74,7 +71,6 @@ describe Kitchen::Driver::Proxy do
74
71
  end
75
72
 
76
73
  describe "#create" do
77
-
78
74
  it "sets :hostname in state config" do
79
75
  driver.stubs(:ssh)
80
76
  driver.create(state)
@@ -100,7 +96,6 @@ describe Kitchen::Driver::Proxy do
100
96
  end
101
97
 
102
98
  describe "#destroy" do
103
-
104
99
  before do
105
100
  state[:hostname] = "beep"
106
101
  end
@@ -23,11 +23,8 @@ require "kitchen/transport/ssh"
23
23
  require "kitchen/verifier/busser"
24
24
 
25
25
  module Kitchen
26
-
27
26
  module Driver
28
-
29
27
  class BackCompat < Kitchen::Driver::SSHBase
30
-
31
28
  def use_run_remote(state, command)
32
29
  connection = Kitchen::SSH.new(*build_ssh_args(state))
33
30
  run_remote(command, connection)
@@ -43,12 +40,10 @@ module Kitchen
43
40
  end
44
41
 
45
42
  class DodgyCompat < Kitchen::Driver::SSHBase
46
-
47
43
  no_parallel_for :converge
48
44
  end
49
45
 
50
46
  class SlowCompat < Kitchen::Driver::SSHBase
51
-
52
47
  no_parallel_for :create, :destroy
53
48
  no_parallel_for :verify
54
49
  end
@@ -56,7 +51,6 @@ module Kitchen
56
51
  end
57
52
 
58
53
  describe Kitchen::Driver::SSHBase do
59
-
60
54
  let(:logged_output) { StringIO.new }
61
55
  let(:logger) { Logger.new(logged_output) }
62
56
  let(:config) { Hash.new }
@@ -78,13 +72,13 @@ describe Kitchen::Driver::SSHBase do
78
72
 
79
73
  let(:provisioner) do
80
74
  stub(
81
- :install_command => "install",
82
- :init_command => "init",
83
- :prepare_command => "prepare",
84
- :run_command => "run",
85
- :create_sandbox => true,
86
- :cleanup_sandbox => true,
87
- :sandbox_path => "/tmp/sandbox"
75
+ install_command: "install",
76
+ init_command: "init",
77
+ prepare_command: "prepare",
78
+ run_command: "run",
79
+ create_sandbox: true,
80
+ cleanup_sandbox: true,
81
+ sandbox_path: "/tmp/sandbox"
88
82
  )
89
83
  end
90
84
 
@@ -96,12 +90,12 @@ describe Kitchen::Driver::SSHBase do
96
90
 
97
91
  let(:instance) do
98
92
  stub(
99
- :name => "coolbeans",
100
- :logger => logger,
101
- :verifier => verifier,
102
- :provisioner => provisioner,
103
- :transport => transport,
104
- :to_str => "instance"
93
+ name: "coolbeans",
94
+ logger: logger,
95
+ verifier: verifier,
96
+ provisioner: provisioner,
97
+ transport: transport,
98
+ to_str: "instance"
105
99
  )
106
100
  end
107
101
 
@@ -114,7 +108,6 @@ describe Kitchen::Driver::SSHBase do
114
108
  end
115
109
 
116
110
  describe "configuration" do
117
-
118
111
  it ":sudo defaults to true" do
119
112
  driver[:sudo].must_equal true
120
113
  end
@@ -135,19 +128,18 @@ describe Kitchen::Driver::SSHBase do
135
128
  # rubocop:disable Metrics/MethodLength, Metrics/AbcSize
136
129
  def self.constructs_an_ssh_connection
137
130
  describe "constructs an SSH connection" do
138
-
139
131
  it "with hostname set from state" do
140
- transport.expects(:connection).with { |state|
132
+ transport.expects(:connection).with do |state|
141
133
  state[:hostname].must_equal "fizzy"
142
- }.returns(stub(:login_command => stub))
134
+ end.returns(stub(login_command: stub))
143
135
 
144
136
  cmd
145
137
  end
146
138
 
147
139
  it "with username set from state" do
148
- transport.expects(:connection).with { |state|
140
+ transport.expects(:connection).with do |state|
149
141
  state[:username].must_equal "bork"
150
- }.returns(stub(:login_command => stub))
142
+ end.returns(stub(login_command: stub))
151
143
 
152
144
  cmd
153
145
  end
@@ -155,9 +147,9 @@ describe Kitchen::Driver::SSHBase do
155
147
  it "with :ssh_key option set from config" do
156
148
  config[:ssh_key] = "wicked"
157
149
 
158
- transport.expects(:connection).with { |state|
150
+ transport.expects(:connection).with do |state|
159
151
  state[:ssh_key].must_equal "wicked"
160
- }.returns(stub(:login_command => stub))
152
+ end.returns(stub(login_command: stub))
161
153
 
162
154
  cmd
163
155
  end
@@ -165,17 +157,17 @@ describe Kitchen::Driver::SSHBase do
165
157
  it "with :ssh_key option set from state" do
166
158
  state[:ssh_key] = "wicked"
167
159
 
168
- transport.expects(:connection).with { |state|
160
+ transport.expects(:connection).with do |state|
169
161
  state[:ssh_key].must_equal "wicked"
170
- }.returns(stub(:login_command => stub))
162
+ end.returns(stub(login_command: stub))
171
163
 
172
164
  cmd
173
165
  end
174
166
 
175
167
  it "with :password option set to falsey by default" do
176
- transport.expects(:connection).with { |state|
168
+ transport.expects(:connection).with do |state|
177
169
  state[:password].nil?
178
- }.returns(stub(:login_command => stub))
170
+ end.returns(stub(login_command: stub))
179
171
 
180
172
  cmd
181
173
  end
@@ -183,9 +175,9 @@ describe Kitchen::Driver::SSHBase do
183
175
  it "with :password option set if given in config" do
184
176
  config[:password] = "psst"
185
177
 
186
- transport.expects(:connection).with { |state|
178
+ transport.expects(:connection).with do |state|
187
179
  state[:password].must_equal "psst"
188
- }.returns(stub(:login_command => stub))
180
+ end.returns(stub(login_command: stub))
189
181
 
190
182
  cmd
191
183
  end
@@ -193,17 +185,17 @@ describe Kitchen::Driver::SSHBase do
193
185
  it "with :password option set if given in state" do
194
186
  state[:password] = "psst"
195
187
 
196
- transport.expects(:connection).with { |state|
188
+ transport.expects(:connection).with do |state|
197
189
  state[:password].must_equal "psst"
198
- }.returns(stub(:login_command => stub))
190
+ end.returns(stub(login_command: stub))
199
191
 
200
192
  cmd
201
193
  end
202
194
 
203
195
  it "with :forward_agent option set to falsey by default" do
204
- transport.expects(:connection).with { |state|
196
+ transport.expects(:connection).with do |state|
205
197
  state[:forward_agent].nil?
206
- }.returns(stub(:login_command => stub))
198
+ end.returns(stub(login_command: stub))
207
199
 
208
200
  cmd
209
201
  end
@@ -211,9 +203,9 @@ describe Kitchen::Driver::SSHBase do
211
203
  it "with :forward_agent option set if given in config" do
212
204
  config[:forward_agent] = "yeah?"
213
205
 
214
- transport.expects(:connection).with { |state|
206
+ transport.expects(:connection).with do |state|
215
207
  state[:forward_agent].must_equal "yeah?"
216
- }.returns(stub(:login_command => stub))
208
+ end.returns(stub(login_command: stub))
217
209
 
218
210
  cmd
219
211
  end
@@ -221,17 +213,17 @@ describe Kitchen::Driver::SSHBase do
221
213
  it "with :forward_agent option set if given in state" do
222
214
  state[:forward_agent] = "yeah?"
223
215
 
224
- transport.expects(:connection).with { |state|
216
+ transport.expects(:connection).with do |state|
225
217
  state[:forward_agent].must_equal "yeah?"
226
- }.returns(stub(:login_command => stub))
218
+ end.returns(stub(login_command: stub))
227
219
 
228
220
  cmd
229
221
  end
230
222
 
231
223
  it "with :port option set to 22 by default" do
232
- transport.expects(:connection).with { |state|
224
+ transport.expects(:connection).with do |state|
233
225
  state[:port].must_equal 22
234
- }.returns(stub(:login_command => stub))
226
+ end.returns(stub(login_command: stub))
235
227
 
236
228
  cmd
237
229
  end
@@ -239,9 +231,9 @@ describe Kitchen::Driver::SSHBase do
239
231
  it "with :port option set if customized in config" do
240
232
  config[:port] = 1234
241
233
 
242
- transport.expects(:connection).with { |state|
234
+ transport.expects(:connection).with do |state|
243
235
  state[:port].must_equal 1234
244
- }.returns(stub(:login_command => stub))
236
+ end.returns(stub(login_command: stub))
245
237
 
246
238
  cmd
247
239
  end
@@ -249,9 +241,9 @@ describe Kitchen::Driver::SSHBase do
249
241
  it "with :port option set if customized in state" do
250
242
  state[:port] = 9999
251
243
 
252
- transport.expects(:connection).with { |state|
244
+ transport.expects(:connection).with do |state|
253
245
  state[:port].must_equal 9999
254
- }.returns(stub(:login_command => stub))
246
+ end.returns(stub(login_command: stub))
255
247
 
256
248
  cmd
257
249
  end
@@ -260,7 +252,6 @@ describe Kitchen::Driver::SSHBase do
260
252
  # rubocop:enable Metrics/MethodLength, Metrics/AbcSize
261
253
 
262
254
  describe "#login_command" do
263
-
264
255
  let(:cmd) { driver.login_command(state) }
265
256
 
266
257
  before do
@@ -269,7 +260,7 @@ describe Kitchen::Driver::SSHBase do
269
260
  end
270
261
 
271
262
  it "returns a LoginCommand" do
272
- transport.stubs(:connection).returns(stub(:login_command => "command"))
263
+ transport.stubs(:connection).returns(stub(login_command: "command"))
273
264
 
274
265
  cmd.must_equal "command"
275
266
  end
@@ -278,9 +269,8 @@ describe Kitchen::Driver::SSHBase do
278
269
  end
279
270
 
280
271
  describe "#converge" do
281
-
282
272
  let(:cmd) { driver.converge(state) }
283
- let(:connection) { stub(:execute => true, :upload => true) }
273
+ let(:connection) { stub(execute: true, upload: true) }
284
274
 
285
275
  before do
286
276
  state[:hostname] = "fizzy"
@@ -340,25 +330,25 @@ describe Kitchen::Driver::SSHBase do
340
330
  cmd
341
331
  end
342
332
 
343
- it "invokes the #install_command with ENV[\"http_proxy\"] set" do
333
+ it 'invokes the #install_command with ENV["http_proxy"] set' do
344
334
  ENV["http_proxy"] = "http://proxy"
345
335
  transport.stubs(:connection).yields(connection)
346
336
  if running_tests_on_windows?
347
- connection.expects(:execute).
348
- with("env http_proxy=http://proxy HTTP_PROXY=http://proxy install")
337
+ connection.expects(:execute)
338
+ .with("env http_proxy=http://proxy HTTP_PROXY=http://proxy install")
349
339
  else
350
340
  connection.expects(:execute).with("env http_proxy=http://proxy install")
351
341
  end
352
342
  cmd
353
343
  end
354
344
 
355
- it "invokes the #install_command with ENV[\"http_proxy\"] and ENV[\"no_proxy\"] set" do
345
+ it 'invokes the #install_command with ENV["http_proxy"] and ENV["no_proxy"] set' do
356
346
  ENV["http_proxy"] = "http://proxy"
357
347
  ENV["no_proxy"] = "http://no"
358
348
  transport.stubs(:connection).yields(connection)
359
349
  if running_tests_on_windows?
360
- connection.expects(:execute).
361
- with("env http_proxy=http://proxy HTTP_PROXY=http://proxy " \
350
+ connection.expects(:execute)
351
+ .with("env http_proxy=http://proxy HTTP_PROXY=http://proxy " \
362
352
  "no_proxy=http://no NO_PROXY=http://no install")
363
353
  else
364
354
  connection.expects(:execute).with("env http_proxy=http://proxy " \
@@ -375,25 +365,25 @@ describe Kitchen::Driver::SSHBase do
375
365
  cmd
376
366
  end
377
367
 
378
- it "invokes the #install_command with ENV[\"https_proxy\"] set" do
368
+ it 'invokes the #install_command with ENV["https_proxy"] set' do
379
369
  ENV["https_proxy"] = "https://proxy"
380
370
  transport.stubs(:connection).yields(connection)
381
371
  if running_tests_on_windows?
382
- connection.expects(:execute).
383
- with("env https_proxy=https://proxy HTTPS_PROXY=https://proxy install")
372
+ connection.expects(:execute)
373
+ .with("env https_proxy=https://proxy HTTPS_PROXY=https://proxy install")
384
374
  else
385
375
  connection.expects(:execute).with("env https_proxy=https://proxy install")
386
376
  end
387
377
  cmd
388
378
  end
389
379
 
390
- it "invokes the #install_command with ENV[\"https_proxy\"] and ENV[\"no_proxy\"] set" do
380
+ it 'invokes the #install_command with ENV["https_proxy"] and ENV["no_proxy"] set' do
391
381
  ENV["https_proxy"] = "https://proxy"
392
382
  ENV["no_proxy"] = "https://no"
393
383
  transport.stubs(:connection).yields(connection)
394
384
  if running_tests_on_windows?
395
- connection.expects(:execute).
396
- with("env https_proxy=https://proxy HTTPS_PROXY=https://proxy " \
385
+ connection.expects(:execute)
386
+ .with("env https_proxy=https://proxy HTTPS_PROXY=https://proxy " \
397
387
  "no_proxy=https://no NO_PROXY=https://no install")
398
388
  else
399
389
  connection.expects(:execute).with("env https_proxy=https://proxy " \
@@ -410,25 +400,25 @@ describe Kitchen::Driver::SSHBase do
410
400
  cmd
411
401
  end
412
402
 
413
- it "invokes the #install_command with ENV[\"ftp_proxy\"] set" do
403
+ it 'invokes the #install_command with ENV["ftp_proxy"] set' do
414
404
  ENV["ftp_proxy"] = "ftp://proxy"
415
405
  transport.stubs(:connection).yields(connection)
416
406
  if running_tests_on_windows?
417
- connection.expects(:execute).
418
- with("env ftp_proxy=ftp://proxy FTP_PROXY=ftp://proxy install")
407
+ connection.expects(:execute)
408
+ .with("env ftp_proxy=ftp://proxy FTP_PROXY=ftp://proxy install")
419
409
  else
420
410
  connection.expects(:execute).with("env ftp_proxy=ftp://proxy install")
421
411
  end
422
412
  cmd
423
413
  end
424
414
 
425
- it "invokes the #install_command with ENV[\"ftp_proxy\"] and ENV[\"no_proxy\"] set" do
415
+ it 'invokes the #install_command with ENV["ftp_proxy"] and ENV["no_proxy"] set' do
426
416
  ENV["ftp_proxy"] = "ftp://proxy"
427
417
  ENV["no_proxy"] = "http://no"
428
418
  transport.stubs(:connection).yields(connection)
429
419
  if running_tests_on_windows?
430
- connection.expects(:execute).
431
- with("env ftp_proxy=ftp://proxy FTP_PROXY=http://proxy " \
420
+ connection.expects(:execute)
421
+ .with("env ftp_proxy=ftp://proxy FTP_PROXY=http://proxy " \
432
422
  "no_proxy=http://no NO_PROXY=http://no install")
433
423
  else
434
424
  connection.expects(:execute).with("env ftp_proxy=ftp://proxy " \
@@ -449,7 +439,6 @@ describe Kitchen::Driver::SSHBase do
449
439
  end
450
440
 
451
441
  describe "transferring files" do
452
-
453
442
  before do
454
443
  transport.stubs(:connection).yields(connection)
455
444
  connection.stubs(:upload)
@@ -465,8 +454,8 @@ describe Kitchen::Driver::SSHBase do
465
454
  it "logs to info" do
466
455
  cmd
467
456
 
468
- logged_output.string.
469
- must_match(/INFO -- : Transferring files to instance$/)
457
+ logged_output.string
458
+ .must_match(/INFO -- : Transferring files to instance$/)
470
459
  end
471
460
 
472
461
  it "logs to debug" do
@@ -491,7 +480,6 @@ describe Kitchen::Driver::SSHBase do
491
480
  end
492
481
 
493
482
  describe "#setup" do
494
-
495
483
  let(:cmd) { driver.setup(state) }
496
484
  let(:connection) { mock }
497
485
 
@@ -553,9 +541,8 @@ describe Kitchen::Driver::SSHBase do
553
541
  end
554
542
 
555
543
  describe "#verify" do
556
-
557
544
  let(:cmd) { driver.verify(state) }
558
- let(:connection) { stub(:execute => true, :upload => true) }
545
+ let(:connection) { stub(execute: true, upload: true) }
559
546
 
560
547
  before do
561
548
  state[:hostname] = "fizzy"
@@ -590,7 +577,7 @@ describe Kitchen::Driver::SSHBase do
590
577
  cmd
591
578
  end
592
579
 
593
- %W[init prepare run].each do |phase|
580
+ %w{init prepare run}.each do |phase|
594
581
  it "invokes Verifier##{phase}_command over ssh" do
595
582
  connection.expects(:execute).with(phase)
596
583
 
@@ -632,8 +619,8 @@ describe Kitchen::Driver::SSHBase do
632
619
  it "logs to info" do
633
620
  cmd
634
621
 
635
- logged_output.string.
636
- must_match(/INFO -- : Transferring files to instance$/)
622
+ logged_output.string
623
+ .must_match(/INFO -- : Transferring files to instance$/)
637
624
  end
638
625
 
639
626
  it "uploads sandbox files" do
@@ -649,8 +636,8 @@ describe Kitchen::Driver::SSHBase do
649
636
  end
650
637
 
651
638
  it "raises an ActionFailed on transfer when TransportFailed is raised" do
652
- connection.stubs(:upload).
653
- raises(Kitchen::Transport::TransportFailed.new("dang"))
639
+ connection.stubs(:upload)
640
+ .raises(Kitchen::Transport::TransportFailed.new("dang"))
654
641
 
655
642
  proc { cmd }.must_raise Kitchen::ActionFailed
656
643
  end
@@ -663,17 +650,16 @@ describe Kitchen::Driver::SSHBase do
663
650
  end
664
651
 
665
652
  describe "#ssh" do
666
-
667
- let(:cmd) { driver.ssh(["host", "user", { :one => "two" }], "go") }
653
+ let(:cmd) { driver.ssh(["host", "user", { one: "two" }], "go") }
668
654
  let(:connection) { mock }
669
655
 
670
656
  it "creates an SSH connection" do
671
657
  connection.stubs(:execute)
672
658
  transport.expects(:connection).with(
673
- :hostname => "host",
674
- :username => "user",
675
- :port => 22,
676
- :one => "two"
659
+ hostname: "host",
660
+ username: "user",
661
+ port: 22,
662
+ one: "two"
677
663
  ).yields(connection)
678
664
 
679
665
  cmd
@@ -688,7 +674,6 @@ describe Kitchen::Driver::SSHBase do
688
674
  end
689
675
 
690
676
  describe "#remote_command" do
691
-
692
677
  let(:cmd) { driver.remote_command(state, "shipit") }
693
678
  let(:connection) { mock }
694
679
 
@@ -699,9 +684,9 @@ describe Kitchen::Driver::SSHBase do
699
684
 
700
685
  it "creates an SSH connection" do
701
686
  transport.expects(:connection).with(
702
- :hostname => "fizzy",
703
- :username => "bork",
704
- :port => 22
687
+ hostname: "fizzy",
688
+ username: "bork",
689
+ port: 22
705
690
  )
706
691
 
707
692
  cmd
@@ -716,18 +701,17 @@ describe Kitchen::Driver::SSHBase do
716
701
  end
717
702
 
718
703
  describe "#wait_for_sshd" do
719
-
720
704
  let(:cmd) do
721
- driver.send(:wait_for_sshd, "host", "user", :one => "two")
705
+ driver.send(:wait_for_sshd, "host", "user", one: "two")
722
706
  end
723
707
 
724
708
  it "creates an SSH connection with merged options" do
725
709
  transport.expects(:connection).with(
726
- :hostname => "host",
727
- :username => "user",
728
- :port => 22,
729
- :one => "two"
730
- ).returns(stub(:wait_until_ready => true))
710
+ hostname: "host",
711
+ username: "user",
712
+ port: 22,
713
+ one: "two"
714
+ ).returns(stub(wait_until_ready: true))
731
715
 
732
716
  cmd
733
717
  end
@@ -742,7 +726,6 @@ describe Kitchen::Driver::SSHBase do
742
726
  end
743
727
 
744
728
  describe "to maintain backwards compatibility" do
745
-
746
729
  let(:driver) do
747
730
  Kitchen::Driver::BackCompat.new(config).finalize_config!(instance)
748
731
  end
@@ -756,7 +739,6 @@ describe Kitchen::Driver::SSHBase do
756
739
  end
757
740
 
758
741
  describe "#logger" do
759
-
760
742
  before { @klog = Kitchen.logger }
761
743
  after { Kitchen.logger = @klog }
762
744
 
@@ -795,7 +777,6 @@ describe Kitchen::Driver::SSHBase do
795
777
  end
796
778
 
797
779
  describe ".no_parallel_for" do
798
-
799
780
  it "registers no serial actions when none are declared" do
800
781
  Kitchen::Driver::SpeedyCompat.serial_actions.must_equal nil
801
782
  end
@@ -813,52 +794,52 @@ describe Kitchen::Driver::SSHBase do
813
794
  end
814
795
 
815
796
  it "raises a ClientError if value is not an action method" do
816
- proc {
817
- Class.new(Kitchen::Driver::BackCompat) {
797
+ proc do
798
+ Class.new(Kitchen::Driver::BackCompat) do
818
799
  no_parallel_for :telling_stories
819
- }
820
- }.must_raise Kitchen::ClientError
800
+ end
801
+ end.must_raise Kitchen::ClientError
821
802
  end
822
803
  end
823
804
 
824
805
  # rubocop:disable Metrics/MethodLength, Metrics/AbcSize
825
806
  def self.constructs_an_ssh_object
826
807
  it "with hostname set from state" do
827
- Kitchen::SSH.expects(:new).with { |hostname, _username, _opts|
808
+ Kitchen::SSH.expects(:new).with do |hostname, _username, _opts|
828
809
  hostname.must_equal "fizzy"
829
- }.returns(connection)
810
+ end.returns(connection)
830
811
 
831
812
  cmd
832
813
  end
833
814
 
834
815
  it "with username set from state" do
835
- Kitchen::SSH.expects(:new).with { |_hostname, username, _opts|
816
+ Kitchen::SSH.expects(:new).with do |_hostname, username, _opts|
836
817
  username.must_equal "bork"
837
- }.returns(connection)
818
+ end.returns(connection)
838
819
 
839
820
  cmd
840
821
  end
841
822
 
842
823
  it "with :user_known_hosts_file option set to /dev/null" do
843
- Kitchen::SSH.expects(:new).with { |_hostname, _username, opts|
824
+ Kitchen::SSH.expects(:new).with do |_hostname, _username, opts|
844
825
  opts[:user_known_hosts_file].must_equal "/dev/null"
845
- }.returns(connection)
826
+ end.returns(connection)
846
827
 
847
828
  cmd
848
829
  end
849
830
 
850
831
  it "with :paranoid option set to false" do
851
- Kitchen::SSH.expects(:new).with { |_hostname, _username, opts|
832
+ Kitchen::SSH.expects(:new).with do |_hostname, _username, opts|
852
833
  opts[:paranoid].must_equal false
853
- }.returns(connection)
834
+ end.returns(connection)
854
835
 
855
836
  cmd
856
837
  end
857
838
 
858
839
  it "with :keys_only option set to falsey by default" do
859
- Kitchen::SSH.expects(:new).with { |_hostname, _username, opts|
840
+ Kitchen::SSH.expects(:new).with do |_hostname, _username, opts|
860
841
  opts[:keys_only].nil?
861
- }.returns(connection)
842
+ end.returns(connection)
862
843
 
863
844
  cmd
864
845
  end
@@ -866,9 +847,9 @@ describe Kitchen::Driver::SSHBase do
866
847
  it "with :keys_only option set to true if :ssh_key is set in config" do
867
848
  config[:ssh_key] = "wicked"
868
849
 
869
- Kitchen::SSH.expects(:new).with { |_hostname, _username, opts|
850
+ Kitchen::SSH.expects(:new).with do |_hostname, _username, opts|
870
851
  opts[:keys_only].must_equal true
871
- }.returns(connection)
852
+ end.returns(connection)
872
853
 
873
854
  cmd
874
855
  end
@@ -876,17 +857,17 @@ describe Kitchen::Driver::SSHBase do
876
857
  it "with :keys_only option set to true if :ssh_key is set in state" do
877
858
  state[:ssh_key] = "wicked"
878
859
 
879
- Kitchen::SSH.expects(:new).with { |_hostname, _username, opts|
860
+ Kitchen::SSH.expects(:new).with do |_hostname, _username, opts|
880
861
  opts[:keys_only].must_equal true
881
- }.returns(connection)
862
+ end.returns(connection)
882
863
 
883
864
  cmd
884
865
  end
885
866
 
886
867
  it "with :keys option set to falsey by default" do
887
- Kitchen::SSH.expects(:new).with { |_hostname, _username, opts|
868
+ Kitchen::SSH.expects(:new).with do |_hostname, _username, opts|
888
869
  opts[:keys].nil?
889
- }.returns(connection)
870
+ end.returns(connection)
890
871
 
891
872
  cmd
892
873
  end
@@ -894,9 +875,9 @@ describe Kitchen::Driver::SSHBase do
894
875
  it "with :keys option set to an array if :ssh_key is set in config" do
895
876
  config[:ssh_key] = "wicked"
896
877
 
897
- Kitchen::SSH.expects(:new).with { |_hostname, _username, opts|
878
+ Kitchen::SSH.expects(:new).with do |_hostname, _username, opts|
898
879
  opts[:keys].must_equal ["wicked"]
899
- }.returns(connection)
880
+ end.returns(connection)
900
881
 
901
882
  cmd
902
883
  end
@@ -904,17 +885,17 @@ describe Kitchen::Driver::SSHBase do
904
885
  it "with :keys option set to an array if :ssh_key is set in state" do
905
886
  state[:ssh_key] = "wicked"
906
887
 
907
- Kitchen::SSH.expects(:new).with { |_hostname, _username, opts|
888
+ Kitchen::SSH.expects(:new).with do |_hostname, _username, opts|
908
889
  opts[:keys].must_equal ["wicked"]
909
- }.returns(connection)
890
+ end.returns(connection)
910
891
 
911
892
  cmd
912
893
  end
913
894
 
914
895
  it "with :password option set to falsey by default" do
915
- Kitchen::SSH.expects(:new).with { |_hostname, _username, opts|
896
+ Kitchen::SSH.expects(:new).with do |_hostname, _username, opts|
916
897
  opts[:password].nil?
917
- }.returns(connection)
898
+ end.returns(connection)
918
899
 
919
900
  cmd
920
901
  end
@@ -922,9 +903,9 @@ describe Kitchen::Driver::SSHBase do
922
903
  it "with :password option set if given in config" do
923
904
  config[:password] = "psst"
924
905
 
925
- Kitchen::SSH.expects(:new).with { |_hostname, _username, opts|
906
+ Kitchen::SSH.expects(:new).with do |_hostname, _username, opts|
926
907
  opts[:password].must_equal "psst"
927
- }.returns(connection)
908
+ end.returns(connection)
928
909
 
929
910
  cmd
930
911
  end
@@ -932,17 +913,17 @@ describe Kitchen::Driver::SSHBase do
932
913
  it "with :password option set if given in state" do
933
914
  state[:password] = "psst"
934
915
 
935
- Kitchen::SSH.expects(:new).with { |_hostname, _username, opts|
916
+ Kitchen::SSH.expects(:new).with do |_hostname, _username, opts|
936
917
  opts[:password].must_equal "psst"
937
- }.returns(connection)
918
+ end.returns(connection)
938
919
 
939
920
  cmd
940
921
  end
941
922
 
942
923
  it "with :forward_agent option set to falsey by default" do
943
- Kitchen::SSH.expects(:new).with { |_hostname, _username, opts|
924
+ Kitchen::SSH.expects(:new).with do |_hostname, _username, opts|
944
925
  opts[:forward_agent].nil?
945
- }.returns(connection)
926
+ end.returns(connection)
946
927
 
947
928
  cmd
948
929
  end
@@ -950,9 +931,9 @@ describe Kitchen::Driver::SSHBase do
950
931
  it "with :forward_agent option set if given in config" do
951
932
  config[:forward_agent] = "yeah?"
952
933
 
953
- Kitchen::SSH.expects(:new).with { |_hostname, _username, opts|
934
+ Kitchen::SSH.expects(:new).with do |_hostname, _username, opts|
954
935
  opts[:forward_agent].must_equal "yeah?"
955
- }.returns(connection)
936
+ end.returns(connection)
956
937
 
957
938
  cmd
958
939
  end
@@ -960,17 +941,17 @@ describe Kitchen::Driver::SSHBase do
960
941
  it "with :forward_agent option set if given in state" do
961
942
  state[:forward_agent] = "yeah?"
962
943
 
963
- Kitchen::SSH.expects(:new).with { |_hostname, _username, opts|
944
+ Kitchen::SSH.expects(:new).with do |_hostname, _username, opts|
964
945
  opts[:forward_agent].must_equal "yeah?"
965
- }.returns(connection)
946
+ end.returns(connection)
966
947
 
967
948
  cmd
968
949
  end
969
950
 
970
951
  it "with :port option set to 22 by default" do
971
- Kitchen::SSH.expects(:new).with { |_hostname, _username, opts|
952
+ Kitchen::SSH.expects(:new).with do |_hostname, _username, opts|
972
953
  opts[:port].must_equal 22
973
- }.returns(connection)
954
+ end.returns(connection)
974
955
 
975
956
  cmd
976
957
  end
@@ -978,9 +959,9 @@ describe Kitchen::Driver::SSHBase do
978
959
  it "with :port option set if customized in config" do
979
960
  config[:port] = 1234
980
961
 
981
- Kitchen::SSH.expects(:new).with { |_hostname, _username, opts|
962
+ Kitchen::SSH.expects(:new).with do |_hostname, _username, opts|
982
963
  opts[:port].must_equal 1234
983
- }.returns(connection)
964
+ end.returns(connection)
984
965
 
985
966
  cmd
986
967
  end
@@ -988,17 +969,17 @@ describe Kitchen::Driver::SSHBase do
988
969
  it "with :port option set if customized in state" do
989
970
  state[:port] = 9999
990
971
 
991
- Kitchen::SSH.expects(:new).with { |_hostname, _username, opts|
972
+ Kitchen::SSH.expects(:new).with do |_hostname, _username, opts|
992
973
  opts[:port].must_equal 9999
993
- }.returns(connection)
974
+ end.returns(connection)
994
975
 
995
976
  cmd
996
977
  end
997
978
 
998
979
  it "with :logger option set to driver's logger" do
999
- Kitchen::SSH.expects(:new).with { |_hostname, _username, opts|
980
+ Kitchen::SSH.expects(:new).with do |_hostname, _username, opts|
1000
981
  opts[:logger].must_equal logger
1001
- }.returns(connection)
982
+ end.returns(connection)
1002
983
 
1003
984
  cmd
1004
985
  end
@@ -1006,9 +987,8 @@ describe Kitchen::Driver::SSHBase do
1006
987
  # rubocop:enable Metrics/MethodLength, Metrics/AbcSize
1007
988
 
1008
989
  describe "#run_remote" do
1009
-
1010
990
  let(:cmd) { driver.use_run_remote(state, "huh") }
1011
- let(:connection) { stub(:exec => true) }
991
+ let(:connection) { stub(exec: true) }
1012
992
 
1013
993
  before do
1014
994
  state[:hostname] = "fizzy"
@@ -1074,10 +1054,9 @@ describe Kitchen::Driver::SSHBase do
1074
1054
  end
1075
1055
 
1076
1056
  describe "#transfer_path" do
1077
-
1078
1057
  let(:cmd) { driver.use_transfer_path(state, ["nope"], "nadda") }
1079
- let(:channel) { stub(:wait => true) }
1080
- let(:connection) { stub(:upload_path! => true, :upload_path => channel) }
1058
+ let(:channel) { stub(wait: true) }
1059
+ let(:connection) { stub(upload_path!: true, upload_path: channel) }
1081
1060
 
1082
1061
  before do
1083
1062
  state[:hostname] = "fizzy"