beaker 4.41.2 → 5.0.0

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 (218) hide show
  1. checksums.yaml +4 -4
  2. data/.github/dependabot.yml +9 -0
  3. data/.github/workflows/release.yml +2 -2
  4. data/.github/workflows/test.yml +26 -13
  5. data/.rubocop.yml +23 -10
  6. data/.rubocop_todo.yml +34 -10
  7. data/CHANGELOG.md +16 -52
  8. data/Gemfile +12 -7
  9. data/HISTORY.md +605 -0
  10. data/Rakefile +99 -111
  11. data/acceptance/config/acceptance-options.rb +1 -1
  12. data/acceptance/config/base/acceptance-options.rb +2 -2
  13. data/acceptance/config/hypervisor/acceptance-options.rb +2 -2
  14. data/acceptance/config/subcommands/acceptance-options.rb +2 -2
  15. data/acceptance/fixtures/module/Rakefile +1 -1
  16. data/acceptance/fixtures/module/spec/acceptance/demo_spec.rb +8 -12
  17. data/acceptance/fixtures/module/spec/classes/init_spec.rb +0 -1
  18. data/acceptance/fixtures/module/spec/spec_helper_acceptance.rb +3 -5
  19. data/acceptance/lib/helpers/test_helper.rb +6 -5
  20. data/acceptance/pre_suite/subcommands/05_install_ruby.rb +2 -3
  21. data/acceptance/pre_suite/subcommands/08_install_beaker.rb +1 -2
  22. data/acceptance/tests/base/dsl/helpers/configuration_test.rb +4 -4
  23. data/acceptance/tests/base/dsl/helpers/hocon_helpers_test.rb +1 -2
  24. data/acceptance/tests/base/dsl/helpers/host_helpers/add_system32_hosts_entry_test.rb +0 -3
  25. data/acceptance/tests/base/dsl/helpers/host_helpers/archive_file_from_test.rb +3 -1
  26. data/acceptance/tests/base/dsl/helpers/host_helpers/backup_the_file_test.rb +9 -9
  27. data/acceptance/tests/base/dsl/helpers/host_helpers/check_for_package_test.rb +0 -4
  28. data/acceptance/tests/base/dsl/helpers/host_helpers/create_remote_file_test.rb +19 -26
  29. data/acceptance/tests/base/dsl/helpers/host_helpers/curl_on_test.rb +2 -2
  30. data/acceptance/tests/base/dsl/helpers/host_helpers/curl_with_retries_test.rb +0 -1
  31. data/acceptance/tests/base/dsl/helpers/host_helpers/on_test.rb +18 -13
  32. data/acceptance/tests/base/dsl/helpers/host_helpers/retry_on_test.rb +3 -3
  33. data/acceptance/tests/base/dsl/helpers/host_helpers/rsync_to_test.rb +22 -27
  34. data/acceptance/tests/base/dsl/helpers/host_helpers/run_cron_on_test.rb +12 -16
  35. data/acceptance/tests/base/dsl/helpers/host_helpers/run_script_on_test.rb +3 -4
  36. data/acceptance/tests/base/dsl/helpers/host_helpers/run_script_test.rb +3 -3
  37. data/acceptance/tests/base/dsl/helpers/host_helpers/scp_from_test.rb +4 -4
  38. data/acceptance/tests/base/dsl/helpers/host_helpers/scp_to_test.rb +3 -4
  39. data/acceptance/tests/base/dsl/helpers/host_helpers/shell_test.rb +5 -5
  40. data/acceptance/tests/base/dsl/helpers/host_helpers/upgrade_package_test.rb +3 -5
  41. data/acceptance/tests/base/dsl/platform_tag_confiner_test.rb +14 -17
  42. data/acceptance/tests/base/dsl/structure_test.rb +5 -11
  43. data/acceptance/tests/base/host/file_test.rb +2 -2
  44. data/acceptance/tests/base/host/group_test.rb +0 -1
  45. data/acceptance/tests/base/host/host_test.rb +66 -63
  46. data/acceptance/tests/base/host/packages.rb +1 -2
  47. data/acceptance/tests/base/host/packages_unix.rb +0 -55
  48. data/acceptance/tests/base/host/user_test.rb +0 -1
  49. data/acceptance/tests/base/host_prebuilt_steps/ssh_environment_test.rb +1 -2
  50. data/acceptance/tests/base/test_suite/export.rb +6 -9
  51. data/acceptance/tests/install/from_file.rb +2 -4
  52. data/acceptance/tests/load_path_bootstrap.rb +1 -1
  53. data/acceptance/tests/subcommands/destroy.rb +19 -21
  54. data/acceptance/tests/subcommands/exec.rb +0 -1
  55. data/acceptance/tests/subcommands/init.rb +2 -3
  56. data/acceptance/tests/subcommands/provision.rb +0 -1
  57. data/beaker.gemspec +4 -7
  58. data/docs/concepts/argument_processing_and_precedence.md +1 -10
  59. data/docs/how_to/debug_beaker_tests.md +12 -12
  60. data/docs/how_to/hosts/eos.md +2 -12
  61. data/docs/how_to/install_puppet.md +0 -18
  62. data/docs/how_to/the_beaker_dsl.md +0 -2
  63. data/lib/beaker/cli.rb +59 -68
  64. data/lib/beaker/command.rb +20 -28
  65. data/lib/beaker/command_factory.rb +3 -2
  66. data/lib/beaker/dsl/assertions.rb +6 -18
  67. data/lib/beaker/dsl/helpers/hocon_helpers.rb +3 -7
  68. data/lib/beaker/dsl/helpers/host_helpers.rb +62 -123
  69. data/lib/beaker/dsl/helpers/test_helpers.rb +3 -5
  70. data/lib/beaker/dsl/helpers/web_helpers.rb +19 -39
  71. data/lib/beaker/dsl/helpers.rb +2 -4
  72. data/lib/beaker/dsl/outcomes.rb +13 -15
  73. data/lib/beaker/dsl/patterns.rb +1 -3
  74. data/lib/beaker/dsl/roles.rb +17 -20
  75. data/lib/beaker/dsl/structure.rb +53 -65
  76. data/lib/beaker/dsl/test_tagging.rb +7 -10
  77. data/lib/beaker/dsl/wrappers.rb +15 -16
  78. data/lib/beaker/dsl.rb +2 -3
  79. data/lib/beaker/host/aix/exec.rb +1 -1
  80. data/lib/beaker/host/aix/file.rb +0 -1
  81. data/lib/beaker/host/aix/group.rb +1 -1
  82. data/lib/beaker/host/aix/user.rb +1 -1
  83. data/lib/beaker/host/aix.rb +3 -4
  84. data/lib/beaker/host/cisco.rb +27 -39
  85. data/lib/beaker/host/eos.rb +4 -30
  86. data/lib/beaker/host/freebsd/exec.rb +1 -1
  87. data/lib/beaker/host/freebsd/pkg.rb +3 -3
  88. data/lib/beaker/host/freebsd.rb +9 -12
  89. data/lib/beaker/host/mac/exec.rb +4 -4
  90. data/lib/beaker/host/mac/group.rb +7 -7
  91. data/lib/beaker/host/mac/pkg.rb +3 -106
  92. data/lib/beaker/host/mac/user.rb +2 -2
  93. data/lib/beaker/host/mac.rb +8 -9
  94. data/lib/beaker/host/pswindows/exec.rb +66 -70
  95. data/lib/beaker/host/pswindows/file.rb +3 -5
  96. data/lib/beaker/host/pswindows/group.rb +3 -3
  97. data/lib/beaker/host/pswindows/pkg.rb +12 -12
  98. data/lib/beaker/host/pswindows/user.rb +3 -3
  99. data/lib/beaker/host/pswindows.rb +4 -3
  100. data/lib/beaker/host/unix/exec.rb +81 -83
  101. data/lib/beaker/host/unix/file.rb +40 -45
  102. data/lib/beaker/host/unix/group.rb +1 -1
  103. data/lib/beaker/host/unix/pkg.rb +138 -401
  104. data/lib/beaker/host/unix/user.rb +2 -2
  105. data/lib/beaker/host/unix.rb +8 -11
  106. data/lib/beaker/host/windows/exec.rb +17 -17
  107. data/lib/beaker/host/windows/file.rb +3 -3
  108. data/lib/beaker/host/windows/group.rb +3 -3
  109. data/lib/beaker/host/windows/pkg.rb +3 -54
  110. data/lib/beaker/host/windows/user.rb +3 -3
  111. data/lib/beaker/host/windows.rb +12 -12
  112. data/lib/beaker/host.rb +76 -133
  113. data/lib/beaker/host_prebuilt_steps.rb +88 -196
  114. data/lib/beaker/hypervisor/noop.rb +2 -4
  115. data/lib/beaker/hypervisor.rb +44 -61
  116. data/lib/beaker/local_connection.rb +2 -4
  117. data/lib/beaker/logger.rb +68 -76
  118. data/lib/beaker/logger_junit.rb +21 -25
  119. data/lib/beaker/network_manager.rb +39 -42
  120. data/lib/beaker/options/command_line_parser.rb +12 -23
  121. data/lib/beaker/options/hosts_file_parser.rb +16 -25
  122. data/lib/beaker/options/options_file_parser.rb +3 -6
  123. data/lib/beaker/options/options_hash.rb +2 -7
  124. data/lib/beaker/options/parser.rb +86 -102
  125. data/lib/beaker/options/presets.rb +114 -123
  126. data/lib/beaker/options/subcommand_options_file_parser.rb +3 -6
  127. data/lib/beaker/options/validator.rb +26 -31
  128. data/lib/beaker/perf.rb +25 -30
  129. data/lib/beaker/platform.rb +26 -37
  130. data/lib/beaker/result.rb +7 -6
  131. data/lib/beaker/shared/error_handler.rb +8 -10
  132. data/lib/beaker/shared/fog_credentials.rb +5 -9
  133. data/lib/beaker/shared/host_manager.rb +36 -41
  134. data/lib/beaker/shared/options_resolver.rb +3 -7
  135. data/lib/beaker/shared/repetition.rb +2 -4
  136. data/lib/beaker/shared/semvar.rb +37 -41
  137. data/lib/beaker/shared/timed.rb +0 -3
  138. data/lib/beaker/shared.rb +1 -1
  139. data/lib/beaker/ssh_connection.rb +38 -47
  140. data/lib/beaker/subcommand.rb +17 -24
  141. data/lib/beaker/subcommands/subcommand_util.rb +4 -4
  142. data/lib/beaker/tasks/quick_start.rb +4 -9
  143. data/lib/beaker/tasks/rake_task.rb +25 -27
  144. data/lib/beaker/tasks/test.rb +4 -4
  145. data/lib/beaker/test_case.rb +16 -28
  146. data/lib/beaker/test_suite.rb +35 -39
  147. data/lib/beaker/test_suite_result.rb +45 -47
  148. data/lib/beaker/version.rb +1 -1
  149. data/lib/beaker.rb +6 -7
  150. data/spec/beaker/cli_spec.rb +121 -142
  151. data/spec/beaker/command_spec.rb +55 -59
  152. data/spec/beaker/dsl/assertions_spec.rb +36 -36
  153. data/spec/beaker/dsl/helpers/host_helpers_spec.rb +110 -131
  154. data/spec/beaker/dsl/helpers/test_helpers_spec.rb +9 -10
  155. data/spec/beaker/dsl/helpers/web_helpers_spec.rb +22 -31
  156. data/spec/beaker/dsl/outcomes_spec.rb +14 -14
  157. data/spec/beaker/dsl/roles_spec.rb +125 -130
  158. data/spec/beaker/dsl/structure_spec.rb +172 -161
  159. data/spec/beaker/dsl/test_tagging_spec.rb +89 -90
  160. data/spec/beaker/dsl/wrappers_spec.rb +32 -33
  161. data/spec/beaker/host/aix_spec.rb +14 -14
  162. data/spec/beaker/host/cisco_spec.rb +84 -94
  163. data/spec/beaker/host/eos_spec.rb +15 -36
  164. data/spec/beaker/host/freebsd/exec_spec.rb +3 -6
  165. data/spec/beaker/host/freebsd/pkg_spec.rb +24 -27
  166. data/spec/beaker/host/mac/exec_spec.rb +2 -3
  167. data/spec/beaker/host/mac/group_spec.rb +48 -57
  168. data/spec/beaker/host/mac/user_spec.rb +54 -63
  169. data/spec/beaker/host/pswindows/exec_spec.rb +30 -32
  170. data/spec/beaker/host/pswindows/file_spec.rb +16 -16
  171. data/spec/beaker/host/pswindows/user_spec.rb +17 -23
  172. data/spec/beaker/host/pswindows_spec.rb +13 -13
  173. data/spec/beaker/host/unix/exec_spec.rb +75 -80
  174. data/spec/beaker/host/unix/file_spec.rb +66 -71
  175. data/spec/beaker/host/unix/pkg_spec.rb +150 -411
  176. data/spec/beaker/host/unix_spec.rb +11 -207
  177. data/spec/beaker/host/windows/exec_spec.rb +30 -32
  178. data/spec/beaker/host/windows/file_spec.rb +18 -19
  179. data/spec/beaker/host/windows/group_spec.rb +10 -12
  180. data/spec/beaker/host/windows/pkg_spec.rb +6 -9
  181. data/spec/beaker/host/windows/user_spec.rb +17 -23
  182. data/spec/beaker/host/windows_spec.rb +39 -39
  183. data/spec/beaker/host_prebuilt_steps_spec.rb +168 -349
  184. data/spec/beaker/host_spec.rb +204 -284
  185. data/spec/beaker/hypervisor/hypervisor_spec.rb +36 -61
  186. data/spec/beaker/localhost_connection_spec.rb +10 -11
  187. data/spec/beaker/logger_junit_spec.rb +19 -30
  188. data/spec/beaker/logger_spec.rb +153 -136
  189. data/spec/beaker/network_manager_spec.rb +23 -23
  190. data/spec/beaker/options/command_line_parser_spec.rb +20 -23
  191. data/spec/beaker/options/hosts_file_parser_spec.rb +30 -32
  192. data/spec/beaker/options/options_file_parser_spec.rb +4 -7
  193. data/spec/beaker/options/options_hash_spec.rb +4 -6
  194. data/spec/beaker/options/parser_spec.rb +167 -167
  195. data/spec/beaker/options/presets_spec.rb +7 -9
  196. data/spec/beaker/options/subcommand_options_parser_spec.rb +13 -14
  197. data/spec/beaker/options/validator_spec.rb +10 -11
  198. data/spec/beaker/perf_spec.rb +18 -21
  199. data/spec/beaker/platform_spec.rb +25 -50
  200. data/spec/beaker/shared/error_handler_spec.rb +7 -16
  201. data/spec/beaker/shared/fog_credentials_spec.rb +29 -29
  202. data/spec/beaker/shared/host_manager_spec.rb +50 -84
  203. data/spec/beaker/shared/options_resolver_spec.rb +9 -12
  204. data/spec/beaker/shared/repetition_spec.rb +17 -24
  205. data/spec/beaker/shared/semvar_spec.rb +21 -26
  206. data/spec/beaker/ssh_connection_spec.rb +76 -83
  207. data/spec/beaker/subcommand/subcommand_util_spec.rb +31 -33
  208. data/spec/beaker/subcommand_spec.rb +75 -77
  209. data/spec/beaker/test_case_spec.rb +25 -50
  210. data/spec/beaker/test_suite_spec.rb +147 -154
  211. data/spec/helpers.rb +39 -45
  212. data/spec/matchers.rb +8 -7
  213. data/spec/mocks.rb +1 -6
  214. data/spec/spec_helper.rb +0 -1
  215. metadata +8 -24
  216. data/acceptance/tests/base/dsl/helpers/host_helpers/deploy_package_repo_test.rb +0 -142
  217. data/acceptance/tests/base/external_resources_test.rb +0 -31
  218. data/spec/beaker/host/mac_spec.rb +0 -113
@@ -2,163 +2,159 @@ require 'spec_helper'
2
2
 
3
3
  module Beaker
4
4
  describe Command do
5
- subject(:cmd) { described_class.new( command, args, options ) }
5
+ subject(:cmd) { described_class.new(command, args, options) }
6
6
 
7
7
  let(:command) { @command || '/bin/ls' }
8
- let(:args) { @args || Array.new }
9
- let(:options) { @options || Hash.new }
8
+ let(:args) { @args || [] }
9
+ let(:options) { @options || {} }
10
10
 
11
- let(:host) {
12
- h = Hash.new
13
- allow( h ).to receive( :environment_string ).and_return( '' )
11
+ let(:host) do
12
+ h = {}
13
+ allow(h).to receive(:environment_string).and_return('')
14
14
  h
15
- }
15
+ end
16
16
 
17
17
  it 'creates a new Command object' do
18
18
  @command = '/usr/bin/blah'
19
- @args = [ 'to', 'the', 'baz' ]
19
+ @args = %w[to the baz]
20
20
  @options = { :foo => 'bar' }
21
21
 
22
- expect( cmd.options ).to be == @options
23
- expect( cmd.args ).to be == @args
24
- expect( cmd.command ).to be == @command
25
-
26
- expect( cmd.args_string ).to be == 'to the baz'
27
- expect( cmd.options_string ).to be == '--foo=bar'
22
+ expect(cmd.options).to be == @options
23
+ expect(cmd.args).to be == @args
24
+ expect(cmd.command).to be == @command
28
25
 
26
+ expect(cmd.args_string).to be == 'to the baz'
27
+ expect(cmd.options_string).to be == '--foo=bar'
29
28
  end
30
29
 
31
30
  describe '#:prepend_cmds' do
32
31
  it 'can prepend commands' do
33
32
  @command = '/usr/bin/blah'
34
- @args = [ 'to', 'the', 'baz' ]
33
+ @args = %w[to the baz]
35
34
  @options = { :foo => 'bar' }
36
- allow( host ).to receive( :prepend_commands ).and_return( 'aloha!' )
37
- allow( host ).to receive( :append_commands ).and_return( '' )
35
+ allow(host).to receive(:prepend_commands).and_return('aloha!')
36
+ allow(host).to receive(:append_commands).and_return('')
38
37
 
39
- expect( cmd.cmd_line( host ) ).to be == "aloha! /usr/bin/blah --foo=bar to the baz"
38
+ expect(cmd.cmd_line(host)).to be == "aloha! /usr/bin/blah --foo=bar to the baz"
40
39
  end
41
40
 
42
41
  it 'can handle no prepend_cmds' do
43
42
  @command = '/usr/bin/blah'
44
- @args = [ 'to', 'the', 'baz' ]
43
+ @args = %w[to the baz]
45
44
  @options = { :foo => 'bar' }
46
- allow( host ).to receive( :prepend_commands ).and_return( '' )
47
- allow( host ).to receive( :append_commands ).and_return( '' )
45
+ allow(host).to receive(:prepend_commands).and_return('')
46
+ allow(host).to receive(:append_commands).and_return('')
48
47
 
49
- expect( cmd.cmd_line( host ) ).to be == "/usr/bin/blah --foo=bar to the baz"
48
+ expect(cmd.cmd_line(host)).to be == "/usr/bin/blah --foo=bar to the baz"
50
49
  end
51
50
  end
52
51
 
53
52
  describe '#:append_commands' do
54
53
  it 'can append commands' do
55
54
  @command = '/usr/bin/blah'
56
- @args = [ 'to', 'the', 'baz' ]
55
+ @args = %w[to the baz]
57
56
  @options = { :foo => 'bar' }
58
- allow( host ).to receive( :prepend_commands ).and_return( 'aloha!' )
59
- allow( host ).to receive( :append_commands ).and_return( 'moo cow' )
57
+ allow(host).to receive(:prepend_commands).and_return('aloha!')
58
+ allow(host).to receive(:append_commands).and_return('moo cow')
60
59
 
61
- expect( cmd.cmd_line( host ) ).to be == "aloha! /usr/bin/blah --foo=bar to the baz moo cow"
60
+ expect(cmd.cmd_line(host)).to be == "aloha! /usr/bin/blah --foo=bar to the baz moo cow"
62
61
  end
63
62
 
64
63
  it 'can handle no append_cmds' do
65
64
  @command = '/usr/bin/blah'
66
- @args = [ 'to', 'the', 'baz' ]
65
+ @args = %w[to the baz]
67
66
  @options = { :foo => 'bar' }
68
- allow( host ).to receive( :prepend_commands ).and_return( '' )
69
- allow( host ).to receive( :append_commands ).and_return( '' )
67
+ allow(host).to receive(:prepend_commands).and_return('')
68
+ allow(host).to receive(:append_commands).and_return('')
70
69
 
71
- expect( cmd.cmd_line( host ) ).to be == "/usr/bin/blah --foo=bar to the baz"
70
+ expect(cmd.cmd_line(host)).to be == "/usr/bin/blah --foo=bar to the baz"
72
71
  end
73
72
  end
74
73
 
75
74
  describe '#options_string' do
76
75
  it 'parses things' do
77
76
  subject.options = { :v => nil, :test => nil,
78
- :server => 'master', :a => 'answers.txt' }
79
- expect( subject.options_string ).to match(/-v/)
80
- expect( subject.options_string ).to match(/--test/)
81
- expect( subject.options_string ).to match(/--server=master/)
82
- expect( subject.options_string ).to match(/-a=answers\.txt/)
77
+ :server => 'master', :a => 'answers.txt', }
78
+ expect(subject.options_string).to match(/-v/)
79
+ expect(subject.options_string).to match(/--test/)
80
+ expect(subject.options_string).to match(/--server=master/)
81
+ expect(subject.options_string).to match(/-a=answers\.txt/)
83
82
  end
84
83
  end
85
84
 
86
85
  describe '#args_string' do
87
86
  it 'joins an array' do
88
87
  subject.args = ['my/command and', nil, 'its args and opts']
89
- expect( subject.args_string ).to be == 'my/command and its args and opts'
88
+ expect(subject.args_string).to be == 'my/command and its args and opts'
90
89
  end
91
90
  end
92
-
93
-
94
91
  end
95
92
 
96
93
  describe HostCommand do
97
- subject(:cmd) { described_class.new( command, args, options ) }
94
+ subject(:cmd) { described_class.new(command, args, options) }
98
95
 
99
96
  let(:command) { @command || '/bin/ls' }
100
- let(:args) { @args || Array.new }
101
- let(:options) { @options || Hash.new }
97
+ let(:args) { @args || [] }
98
+ let(:options) { @options || {} }
102
99
 
103
- let(:host) { Hash.new }
100
+ let(:host) { {} }
104
101
 
105
102
  it 'returns a simple string passed in' do
106
103
  @command = "pants"
107
- expect( cmd.cmd_line host ).to be === @command
104
+ expect(cmd.cmd_line host).to be === @command
108
105
  end
109
106
 
110
107
  it 'returns single quoted string correctly' do
111
108
  @command = "str_p = 'pants'; str_p"
112
- expect( cmd.cmd_line host ).to be === @command
109
+ expect(cmd.cmd_line host).to be === @command
113
110
  end
114
111
 
115
112
  it 'returns empty strings when given the escaped version of the same' do
116
113
  @command = "\"\""
117
- expect( cmd.cmd_line host ).to be === ""
114
+ expect(cmd.cmd_line host).to be === ""
118
115
  end
119
116
  end
120
117
 
121
118
  describe SedCommand do
122
- subject(:cmd) { described_class.new( platform, expression, filename, options ) }
119
+ subject(:cmd) { described_class.new(platform, expression, filename, options) }
123
120
 
124
- let(:host) {
125
- h = Hash.new
126
- allow( h ).to receive( :environment_string ).and_return( '' )
127
- allow( h ).to receive( :prepend_commands ).and_return( '' )
128
- allow( h ).to receive( :append_commands ).and_return( '' )
121
+ let(:host) do
122
+ h = {}
123
+ allow(h).to receive(:environment_string).and_return('')
124
+ allow(h).to receive(:prepend_commands).and_return('')
125
+ allow(h).to receive(:append_commands).and_return('')
129
126
  h
130
- }
127
+ end
131
128
  let(:platform) { @platform || 'unix' }
132
129
  let(:expression) { @expression || 's/b/s/' }
133
130
  let(:filename) { @filename || '/fakefile' }
134
- let(:options) { @options || Hash.new }
135
-
131
+ let(:options) { @options || {} }
136
132
 
137
133
  it 'forms a basic sed command correctly' do
138
- expect( cmd.cmd_line host ).to be === "sed -i -e \"#{expression}\" #{filename}"
134
+ expect(cmd.cmd_line host).to be === "sed -i -e \"#{expression}\" #{filename}"
139
135
  end
140
136
 
141
137
  it 'provides the -i option to rewrite file in-place on non-solaris hosts' do
142
- expect( cmd.cmd_line host ).to include('-i')
138
+ expect(cmd.cmd_line host).to include('-i')
143
139
  end
144
140
 
145
141
  describe 'on solaris hosts' do
146
142
  it 'removes the -i option correctly' do
147
143
  @platform = 'solaris'
148
- expect( cmd.cmd_line host ).not_to include('-i')
144
+ expect(cmd.cmd_line host).not_to include('-i')
149
145
  end
150
146
 
151
147
  it 'deals with in-place file substitution correctly' do
152
148
  @platform = 'solaris'
153
149
  default_temp_file = "#{filename}.tmp"
154
- expect( cmd.cmd_line host ).to include(" > #{default_temp_file} && mv #{default_temp_file} #{filename} && rm -f #{default_temp_file}")
150
+ expect(cmd.cmd_line host).to include(" > #{default_temp_file} && mv #{default_temp_file} #{filename} && rm -f #{default_temp_file}")
155
151
  end
156
152
 
157
153
  it 'allows you to provide the name of the temp file for in-place file substitution' do
158
154
  @platform = 'solaris'
159
155
  temp_file = 'mytemp.tmp'
160
156
  @options = { :temp_file => temp_file }
161
- expect( cmd.cmd_line host ).to include(" > #{temp_file} && mv #{temp_file} #{filename} && rm -f #{temp_file}")
157
+ expect(cmd.cmd_line host).to include(" > #{temp_file} && mv #{temp_file} #{filename} && rm -f #{temp_file}")
162
158
  end
163
159
  end
164
160
  end
@@ -7,11 +7,11 @@ end
7
7
  describe ClassMixedWithDSLAssertions do
8
8
  describe '#assert_output' do
9
9
  it 'defaults to checking stdout' do
10
- stdout = <<CONSOLE
11
- This should not have space infront of it
12
- While this should have two spaces infront of it
13
- And this 3, all lines should be to stdout
14
- CONSOLE
10
+ stdout = <<~CONSOLE
11
+ This should not have space infront of it
12
+ While this should have two spaces infront of it
13
+ And this 3, all lines should be to stdout
14
+ CONSOLE
15
15
 
16
16
  expectation = <<CONSOLE
17
17
  This should not have space infront of it
@@ -20,30 +20,30 @@ CONSOLE
20
20
  CONSOLE
21
21
 
22
22
  result = double
23
- expect( result ).to receive( :nil? ).at_least( :once ).and_return( false )
24
- expect( result ).to receive( :stdout ).and_return( stdout )
25
- expect( result ).to receive( :output ).and_return( stdout )
26
- expect( result ).to receive( :stderr ).and_return( '' )
23
+ expect(result).to receive(:nil?).at_least(:once).and_return(false)
24
+ expect(result).to receive(:stdout).and_return(stdout)
25
+ expect(result).to receive(:output).and_return(stdout)
26
+ expect(result).to receive(:stderr).and_return('')
27
27
 
28
- expect( subject ).to receive( :result ).at_least( :once ).and_return( result )
28
+ expect(subject).to receive(:result).at_least(:once).and_return(result)
29
29
  expect { subject.assert_output expectation }.not_to raise_error
30
30
  end
31
31
 
32
32
  it 'allows specifying stream markers' do
33
- output = <<OUTPUT
34
- This is on stdout
35
- While this is on stderr
36
- And THIS is again on stdout
37
- OUTPUT
33
+ output = <<~OUTPUT
34
+ This is on stdout
35
+ While this is on stderr
36
+ And THIS is again on stdout
37
+ OUTPUT
38
38
 
39
- stdout = <<STDOUT
40
- This is on stdout
41
- And THIS is again on stdout
42
- STDOUT
39
+ stdout = <<~STDOUT
40
+ This is on stdout
41
+ And THIS is again on stdout
42
+ STDOUT
43
43
 
44
- stderr = <<STDERR
45
- While this is on stderr
46
- STDERR
44
+ stderr = <<~STDERR
45
+ While this is on stderr
46
+ STDERR
47
47
 
48
48
  expectation = <<EXPECT
49
49
  STDOUT> This is on stdout
@@ -52,22 +52,22 @@ STDERR
52
52
  EXPECT
53
53
 
54
54
  result = double
55
- expect( result ).to receive( :nil? ).at_least( :once ).and_return( false )
56
- expect( result ).to receive( :stdout ).and_return( stdout )
57
- expect( result ).to receive( :output ).and_return( output )
58
- expect( result ).to receive( :stderr ).and_return( stderr )
55
+ expect(result).to receive(:nil?).at_least(:once).and_return(false)
56
+ expect(result).to receive(:stdout).and_return(stdout)
57
+ expect(result).to receive(:output).and_return(output)
58
+ expect(result).to receive(:stderr).and_return(stderr)
59
59
 
60
- expect( subject ).to receive( :result ).at_least( :once ).and_return( result )
60
+ expect(subject).to receive(:result).at_least(:once).and_return(result)
61
61
  expect { subject.assert_output expectation }.not_to raise_error
62
62
  end
63
63
 
64
64
  it 'raises an approriate error when output does not match expectations' do
65
65
  FakeFS.without do
66
- output = <<OUTPUT
67
- This is on stdout
68
- Holy Crap, what HAPPENED!?!?!?
69
- And THIS is again on stdout
70
- OUTPUT
66
+ output = <<~OUTPUT
67
+ This is on stdout
68
+ Holy Crap, what HAPPENED!?!?!?
69
+ And THIS is again on stdout
70
+ OUTPUT
71
71
 
72
72
  expectation = <<EXPECT
73
73
  STDOUT> This is on stdout
@@ -75,11 +75,11 @@ OUTPUT
75
75
  STDOUT> And THIS is again on stdout
76
76
  EXPECT
77
77
  result = double
78
- expect( result ).to receive( :nil? ).at_least( :once ).and_return( false )
79
- expect( result ).to receive( :output ).and_return( output )
78
+ expect(result).to receive(:nil?).at_least(:once).and_return(false)
79
+ expect(result).to receive(:output).and_return(output)
80
80
 
81
- expect( subject ).to receive( :result ).at_least( :once ).and_return( result )
82
- expect { subject.assert_output expectation }.to raise_error( Minitest::Assertion )
81
+ expect(subject).to receive(:result).at_least(:once).and_return(result)
82
+ expect { subject.assert_output expectation }.to raise_error(MiniTest::Assertion)
83
83
  end
84
84
  end
85
85
  end