beaker 4.38.1 → 5.0.0

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