beaker 4.40.1 → 5.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (217) 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 +13 -11
  8. data/Gemfile +12 -7
  9. data/Rakefile +99 -111
  10. data/acceptance/config/acceptance-options.rb +1 -1
  11. data/acceptance/config/base/acceptance-options.rb +2 -2
  12. data/acceptance/config/hypervisor/acceptance-options.rb +2 -2
  13. data/acceptance/config/subcommands/acceptance-options.rb +2 -2
  14. data/acceptance/fixtures/module/Rakefile +1 -1
  15. data/acceptance/fixtures/module/spec/acceptance/demo_spec.rb +8 -12
  16. data/acceptance/fixtures/module/spec/classes/init_spec.rb +0 -1
  17. data/acceptance/fixtures/module/spec/spec_helper_acceptance.rb +3 -5
  18. data/acceptance/lib/helpers/test_helper.rb +4 -3
  19. data/acceptance/pre_suite/subcommands/05_install_ruby.rb +2 -3
  20. data/acceptance/pre_suite/subcommands/08_install_beaker.rb +1 -2
  21. data/acceptance/tests/base/dsl/helpers/configuration_test.rb +4 -4
  22. data/acceptance/tests/base/dsl/helpers/hocon_helpers_test.rb +1 -2
  23. data/acceptance/tests/base/dsl/helpers/host_helpers/add_system32_hosts_entry_test.rb +0 -3
  24. data/acceptance/tests/base/dsl/helpers/host_helpers/archive_file_from_test.rb +3 -1
  25. data/acceptance/tests/base/dsl/helpers/host_helpers/backup_the_file_test.rb +9 -9
  26. data/acceptance/tests/base/dsl/helpers/host_helpers/check_for_package_test.rb +0 -4
  27. data/acceptance/tests/base/dsl/helpers/host_helpers/create_remote_file_test.rb +19 -26
  28. data/acceptance/tests/base/dsl/helpers/host_helpers/curl_on_test.rb +2 -2
  29. data/acceptance/tests/base/dsl/helpers/host_helpers/curl_with_retries_test.rb +0 -1
  30. data/acceptance/tests/base/dsl/helpers/host_helpers/on_test.rb +18 -13
  31. data/acceptance/tests/base/dsl/helpers/host_helpers/retry_on_test.rb +3 -3
  32. data/acceptance/tests/base/dsl/helpers/host_helpers/rsync_to_test.rb +22 -27
  33. data/acceptance/tests/base/dsl/helpers/host_helpers/run_cron_on_test.rb +12 -16
  34. data/acceptance/tests/base/dsl/helpers/host_helpers/run_script_on_test.rb +3 -4
  35. data/acceptance/tests/base/dsl/helpers/host_helpers/run_script_test.rb +3 -3
  36. data/acceptance/tests/base/dsl/helpers/host_helpers/scp_from_test.rb +4 -4
  37. data/acceptance/tests/base/dsl/helpers/host_helpers/scp_to_test.rb +3 -4
  38. data/acceptance/tests/base/dsl/helpers/host_helpers/shell_test.rb +5 -5
  39. data/acceptance/tests/base/dsl/helpers/host_helpers/upgrade_package_test.rb +3 -5
  40. data/acceptance/tests/base/dsl/platform_tag_confiner_test.rb +14 -17
  41. data/acceptance/tests/base/dsl/structure_test.rb +5 -11
  42. data/acceptance/tests/base/host/file_test.rb +2 -2
  43. data/acceptance/tests/base/host/group_test.rb +0 -1
  44. data/acceptance/tests/base/host/host_test.rb +66 -63
  45. data/acceptance/tests/base/host/packages.rb +1 -2
  46. data/acceptance/tests/base/host/packages_unix.rb +0 -55
  47. data/acceptance/tests/base/host/user_test.rb +0 -1
  48. data/acceptance/tests/base/host_prebuilt_steps/ssh_environment_test.rb +1 -2
  49. data/acceptance/tests/base/test_suite/export.rb +6 -9
  50. data/acceptance/tests/install/from_file.rb +2 -4
  51. data/acceptance/tests/load_path_bootstrap.rb +1 -1
  52. data/acceptance/tests/subcommands/destroy.rb +19 -21
  53. data/acceptance/tests/subcommands/exec.rb +0 -1
  54. data/acceptance/tests/subcommands/init.rb +2 -3
  55. data/acceptance/tests/subcommands/provision.rb +0 -1
  56. data/beaker.gemspec +4 -7
  57. data/docs/concepts/argument_processing_and_precedence.md +1 -10
  58. data/docs/how_to/debug_beaker_tests.md +12 -12
  59. data/docs/how_to/hosts/eos.md +2 -12
  60. data/docs/how_to/install_puppet.md +0 -18
  61. data/docs/how_to/the_beaker_dsl.md +0 -2
  62. data/lib/beaker/cli.rb +59 -68
  63. data/lib/beaker/command.rb +20 -28
  64. data/lib/beaker/command_factory.rb +3 -2
  65. data/lib/beaker/dsl/assertions.rb +6 -18
  66. data/lib/beaker/dsl/helpers/hocon_helpers.rb +3 -7
  67. data/lib/beaker/dsl/helpers/host_helpers.rb +62 -123
  68. data/lib/beaker/dsl/helpers/test_helpers.rb +3 -5
  69. data/lib/beaker/dsl/helpers/web_helpers.rb +19 -39
  70. data/lib/beaker/dsl/helpers.rb +2 -4
  71. data/lib/beaker/dsl/outcomes.rb +13 -15
  72. data/lib/beaker/dsl/patterns.rb +1 -3
  73. data/lib/beaker/dsl/roles.rb +17 -20
  74. data/lib/beaker/dsl/structure.rb +53 -65
  75. data/lib/beaker/dsl/test_tagging.rb +7 -10
  76. data/lib/beaker/dsl/wrappers.rb +15 -16
  77. data/lib/beaker/dsl.rb +2 -3
  78. data/lib/beaker/host/aix/exec.rb +1 -1
  79. data/lib/beaker/host/aix/file.rb +0 -1
  80. data/lib/beaker/host/aix/group.rb +1 -1
  81. data/lib/beaker/host/aix/user.rb +1 -1
  82. data/lib/beaker/host/aix.rb +3 -4
  83. data/lib/beaker/host/cisco.rb +27 -39
  84. data/lib/beaker/host/eos.rb +4 -30
  85. data/lib/beaker/host/freebsd/exec.rb +1 -1
  86. data/lib/beaker/host/freebsd/pkg.rb +3 -3
  87. data/lib/beaker/host/freebsd.rb +9 -12
  88. data/lib/beaker/host/mac/exec.rb +4 -4
  89. data/lib/beaker/host/mac/group.rb +7 -7
  90. data/lib/beaker/host/mac/pkg.rb +3 -106
  91. data/lib/beaker/host/mac/user.rb +2 -2
  92. data/lib/beaker/host/mac.rb +8 -9
  93. data/lib/beaker/host/pswindows/exec.rb +66 -70
  94. data/lib/beaker/host/pswindows/file.rb +3 -5
  95. data/lib/beaker/host/pswindows/group.rb +3 -3
  96. data/lib/beaker/host/pswindows/pkg.rb +12 -12
  97. data/lib/beaker/host/pswindows/user.rb +3 -3
  98. data/lib/beaker/host/pswindows.rb +4 -3
  99. data/lib/beaker/host/unix/exec.rb +80 -82
  100. data/lib/beaker/host/unix/file.rb +38 -43
  101. data/lib/beaker/host/unix/group.rb +1 -1
  102. data/lib/beaker/host/unix/pkg.rb +154 -417
  103. data/lib/beaker/host/unix/user.rb +2 -2
  104. data/lib/beaker/host/unix.rb +8 -11
  105. data/lib/beaker/host/windows/exec.rb +17 -17
  106. data/lib/beaker/host/windows/file.rb +3 -3
  107. data/lib/beaker/host/windows/group.rb +3 -3
  108. data/lib/beaker/host/windows/pkg.rb +3 -54
  109. data/lib/beaker/host/windows/user.rb +3 -3
  110. data/lib/beaker/host/windows.rb +12 -12
  111. data/lib/beaker/host.rb +76 -133
  112. data/lib/beaker/host_prebuilt_steps.rb +93 -198
  113. data/lib/beaker/hypervisor/noop.rb +2 -4
  114. data/lib/beaker/hypervisor.rb +44 -61
  115. data/lib/beaker/local_connection.rb +2 -4
  116. data/lib/beaker/logger.rb +68 -76
  117. data/lib/beaker/logger_junit.rb +21 -25
  118. data/lib/beaker/network_manager.rb +39 -42
  119. data/lib/beaker/options/command_line_parser.rb +12 -23
  120. data/lib/beaker/options/hosts_file_parser.rb +16 -24
  121. data/lib/beaker/options/options_file_parser.rb +3 -6
  122. data/lib/beaker/options/options_hash.rb +2 -7
  123. data/lib/beaker/options/parser.rb +86 -102
  124. data/lib/beaker/options/presets.rb +114 -123
  125. data/lib/beaker/options/subcommand_options_file_parser.rb +3 -6
  126. data/lib/beaker/options/validator.rb +26 -31
  127. data/lib/beaker/perf.rb +22 -27
  128. data/lib/beaker/platform.rb +38 -46
  129. data/lib/beaker/result.rb +7 -6
  130. data/lib/beaker/shared/error_handler.rb +8 -10
  131. data/lib/beaker/shared/fog_credentials.rb +5 -9
  132. data/lib/beaker/shared/host_manager.rb +36 -41
  133. data/lib/beaker/shared/options_resolver.rb +3 -7
  134. data/lib/beaker/shared/repetition.rb +2 -4
  135. data/lib/beaker/shared/semvar.rb +37 -41
  136. data/lib/beaker/shared/timed.rb +0 -3
  137. data/lib/beaker/shared.rb +1 -1
  138. data/lib/beaker/ssh_connection.rb +38 -47
  139. data/lib/beaker/subcommand.rb +17 -24
  140. data/lib/beaker/subcommands/subcommand_util.rb +4 -4
  141. data/lib/beaker/tasks/quick_start.rb +4 -9
  142. data/lib/beaker/tasks/rake_task.rb +25 -27
  143. data/lib/beaker/tasks/test.rb +4 -4
  144. data/lib/beaker/test_case.rb +15 -27
  145. data/lib/beaker/test_suite.rb +35 -39
  146. data/lib/beaker/test_suite_result.rb +45 -47
  147. data/lib/beaker/version.rb +1 -1
  148. data/lib/beaker.rb +5 -6
  149. data/spec/beaker/cli_spec.rb +121 -142
  150. data/spec/beaker/command_spec.rb +55 -59
  151. data/spec/beaker/dsl/assertions_spec.rb +36 -36
  152. data/spec/beaker/dsl/helpers/host_helpers_spec.rb +110 -131
  153. data/spec/beaker/dsl/helpers/test_helpers_spec.rb +9 -10
  154. data/spec/beaker/dsl/helpers/web_helpers_spec.rb +22 -31
  155. data/spec/beaker/dsl/outcomes_spec.rb +14 -14
  156. data/spec/beaker/dsl/roles_spec.rb +125 -130
  157. data/spec/beaker/dsl/structure_spec.rb +169 -158
  158. data/spec/beaker/dsl/test_tagging_spec.rb +89 -90
  159. data/spec/beaker/dsl/wrappers_spec.rb +32 -33
  160. data/spec/beaker/host/aix_spec.rb +14 -14
  161. data/spec/beaker/host/cisco_spec.rb +84 -94
  162. data/spec/beaker/host/eos_spec.rb +15 -36
  163. data/spec/beaker/host/freebsd/exec_spec.rb +3 -6
  164. data/spec/beaker/host/freebsd/pkg_spec.rb +24 -27
  165. data/spec/beaker/host/mac/exec_spec.rb +2 -3
  166. data/spec/beaker/host/mac/group_spec.rb +47 -56
  167. data/spec/beaker/host/mac/user_spec.rb +53 -62
  168. data/spec/beaker/host/pswindows/exec_spec.rb +30 -32
  169. data/spec/beaker/host/pswindows/file_spec.rb +16 -16
  170. data/spec/beaker/host/pswindows/user_spec.rb +17 -23
  171. data/spec/beaker/host/pswindows_spec.rb +13 -13
  172. data/spec/beaker/host/unix/exec_spec.rb +75 -80
  173. data/spec/beaker/host/unix/file_spec.rb +66 -73
  174. data/spec/beaker/host/unix/pkg_spec.rb +155 -401
  175. data/spec/beaker/host/unix_spec.rb +11 -207
  176. data/spec/beaker/host/windows/exec_spec.rb +30 -32
  177. data/spec/beaker/host/windows/file_spec.rb +18 -19
  178. data/spec/beaker/host/windows/group_spec.rb +10 -12
  179. data/spec/beaker/host/windows/pkg_spec.rb +6 -9
  180. data/spec/beaker/host/windows/user_spec.rb +17 -23
  181. data/spec/beaker/host/windows_spec.rb +39 -39
  182. data/spec/beaker/host_prebuilt_steps_spec.rb +172 -326
  183. data/spec/beaker/host_spec.rb +204 -284
  184. data/spec/beaker/hypervisor/hypervisor_spec.rb +36 -61
  185. data/spec/beaker/localhost_connection_spec.rb +10 -11
  186. data/spec/beaker/logger_junit_spec.rb +19 -30
  187. data/spec/beaker/logger_spec.rb +153 -136
  188. data/spec/beaker/network_manager_spec.rb +23 -23
  189. data/spec/beaker/options/command_line_parser_spec.rb +20 -23
  190. data/spec/beaker/options/hosts_file_parser_spec.rb +30 -32
  191. data/spec/beaker/options/options_file_parser_spec.rb +4 -7
  192. data/spec/beaker/options/options_hash_spec.rb +4 -6
  193. data/spec/beaker/options/parser_spec.rb +167 -167
  194. data/spec/beaker/options/presets_spec.rb +7 -9
  195. data/spec/beaker/options/subcommand_options_parser_spec.rb +13 -14
  196. data/spec/beaker/options/validator_spec.rb +10 -11
  197. data/spec/beaker/perf_spec.rb +18 -21
  198. data/spec/beaker/platform_spec.rb +25 -36
  199. data/spec/beaker/shared/error_handler_spec.rb +7 -16
  200. data/spec/beaker/shared/fog_credentials_spec.rb +29 -29
  201. data/spec/beaker/shared/host_manager_spec.rb +50 -84
  202. data/spec/beaker/shared/options_resolver_spec.rb +9 -12
  203. data/spec/beaker/shared/repetition_spec.rb +17 -24
  204. data/spec/beaker/shared/semvar_spec.rb +21 -26
  205. data/spec/beaker/ssh_connection_spec.rb +76 -83
  206. data/spec/beaker/subcommand/subcommand_util_spec.rb +31 -33
  207. data/spec/beaker/subcommand_spec.rb +75 -77
  208. data/spec/beaker/test_case_spec.rb +25 -50
  209. data/spec/beaker/test_suite_spec.rb +147 -154
  210. data/spec/helpers.rb +48 -53
  211. data/spec/matchers.rb +8 -7
  212. data/spec/mocks.rb +1 -6
  213. data/spec/spec_helper.rb +0 -1
  214. metadata +7 -24
  215. data/acceptance/tests/base/dsl/helpers/host_helpers/deploy_package_repo_test.rb +0 -142
  216. data/acceptance/tests/base/external_resources_test.rb +0 -31
  217. 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