aruba 1.0.0 → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (67) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +29 -8
  3. data/.rubocop_todo.yml +100 -146
  4. data/CHANGELOG.md +23 -1
  5. data/CONTRIBUTING.md +0 -8
  6. data/Gemfile +3 -1
  7. data/Rakefile +6 -4
  8. data/appveyor.yml +0 -1
  9. data/aruba.gemspec +7 -4
  10. data/fixtures/cli-app/cli-app.gemspec +3 -2
  11. data/fixtures/cli-app/spec/spec_helper.rb +2 -1
  12. data/fixtures/empty-app/cli-app.gemspec +3 -2
  13. data/lib/aruba/api/bundler.rb +1 -1
  14. data/lib/aruba/api/commands.rb +8 -11
  15. data/lib/aruba/api/core.rb +48 -33
  16. data/lib/aruba/api/environment.rb +12 -4
  17. data/lib/aruba/api/filesystem.rb +27 -23
  18. data/lib/aruba/api/text.rb +15 -3
  19. data/lib/aruba/basic_configuration.rb +5 -6
  20. data/lib/aruba/basic_configuration/option.rb +2 -2
  21. data/lib/aruba/cli.rb +4 -1
  22. data/lib/aruba/config_wrapper.rb +17 -2
  23. data/lib/aruba/configuration.rb +27 -12
  24. data/lib/aruba/console.rb +0 -2
  25. data/lib/aruba/console/help.rb +5 -2
  26. data/lib/aruba/contracts/absolute_path.rb +1 -1
  27. data/lib/aruba/contracts/is_power_of_two.rb +2 -2
  28. data/lib/aruba/contracts/relative_path.rb +1 -1
  29. data/lib/aruba/cucumber/command.rb +83 -64
  30. data/lib/aruba/cucumber/file.rb +42 -22
  31. data/lib/aruba/cucumber/hooks.rb +4 -1
  32. data/lib/aruba/cucumber/testing_frameworks.rb +14 -12
  33. data/lib/aruba/event_bus.rb +4 -2
  34. data/lib/aruba/event_bus/name_resolver.rb +9 -8
  35. data/lib/aruba/events.rb +2 -1
  36. data/lib/aruba/hooks.rb +2 -4
  37. data/lib/aruba/in_config_wrapper.rb +8 -5
  38. data/lib/aruba/initializer.rb +5 -3
  39. data/lib/aruba/matchers/base/base_matcher.rb +2 -11
  40. data/lib/aruba/matchers/base/object_formatter.rb +0 -3
  41. data/lib/aruba/matchers/collection/include_an_object.rb +4 -4
  42. data/lib/aruba/matchers/command/be_successfully_executed.rb +3 -1
  43. data/lib/aruba/matchers/command/have_exit_status.rb +3 -1
  44. data/lib/aruba/matchers/command/have_finished_in_time.rb +3 -1
  45. data/lib/aruba/matchers/command/have_output.rb +3 -1
  46. data/lib/aruba/matchers/command/have_output_on_stderr.rb +3 -1
  47. data/lib/aruba/matchers/command/have_output_on_stdout.rb +3 -1
  48. data/lib/aruba/matchers/directory/have_sub_directory.rb +8 -3
  49. data/lib/aruba/matchers/file/have_file_size.rb +4 -2
  50. data/lib/aruba/matchers/path/have_permissions.rb +4 -2
  51. data/lib/aruba/platforms/announcer.rb +18 -6
  52. data/lib/aruba/platforms/aruba_file_creator.rb +3 -1
  53. data/lib/aruba/platforms/aruba_fixed_size_file_creator.rb +7 -2
  54. data/lib/aruba/platforms/command_monitor.rb +3 -3
  55. data/lib/aruba/platforms/unix_environment_variables.rb +2 -4
  56. data/lib/aruba/platforms/unix_which.rb +1 -1
  57. data/lib/aruba/platforms/windows_environment_variables.rb +2 -1
  58. data/lib/aruba/platforms/windows_which.rb +6 -2
  59. data/lib/aruba/processes/debug_process.rb +4 -2
  60. data/lib/aruba/processes/in_process.rb +4 -2
  61. data/lib/aruba/processes/spawn_process.rb +18 -10
  62. data/lib/aruba/rspec.rb +25 -15
  63. data/lib/aruba/runtime.rb +11 -4
  64. data/lib/aruba/setup.rb +23 -10
  65. data/lib/aruba/tasks/docker_helpers.rb +3 -1
  66. data/lib/aruba/version.rb +1 -1
  67. metadata +22 -8
@@ -3,11 +3,13 @@ Given(/^I use (?:a|the) fixture(?: named)? "([^"]*)"$/) do |name|
3
3
  cd name
4
4
  end
5
5
 
6
- Given(/^I copy (?:a|the) (?:file|directory)(?: (?:named|from))? "([^"]*)" to "([^"]*)"$/) do |source, destination|
6
+ Given(/^I copy (?:a|the) (?:file|directory)(?: (?:named|from))? "([^"]*)" to "([^"]*)"$/) \
7
+ do |source, destination|
7
8
  copy source, destination
8
9
  end
9
10
 
10
- Given(/^I move (?:a|the) (?:file|directory)(?: (?:named|from))? "([^"]*)" to "([^"]*)"$/) do |source, destination|
11
+ Given(/^I move (?:a|the) (?:file|directory)(?: (?:named|from))? "([^"]*)" to "([^"]*)"$/) \
12
+ do |source, destination|
11
13
  move source, destination
12
14
  end
13
15
 
@@ -15,7 +17,8 @@ Given(/^(?:a|the|(?:an empty)) directory(?: named)? "([^"]*)"$/) do |dir_name|
15
17
  create_directory(dir_name)
16
18
  end
17
19
 
18
- Given(/^(?:a|the) directory(?: named)? "([^"]*)" with mode "([^"]*)"$/) do |dir_name, dir_mode|
20
+ Given(/^(?:a|the) directory(?: named)? "([^"]*)" with mode "([^"]*)"$/) \
21
+ do |dir_name, dir_mode|
19
22
  create_directory(dir_name)
20
23
  chmod(dir_mode, dir_name)
21
24
  end
@@ -32,7 +35,8 @@ Given(/^(?:a|the) file(?: named)? "([^"]*)" with "([^"]*)"$/) do |file_name, fil
32
35
  write_file(file_name, unescape_text(file_content))
33
36
  end
34
37
 
35
- Given(/^(?:a|the) file(?: named)? "([^"]*)" with mode "([^"]*)" and with:$/) do |file_name, file_mode, file_content|
38
+ Given(/^(?:a|the) file(?: named)? "([^"]*)" with mode "([^"]*)" and with:$/) \
39
+ do |file_name, file_mode, file_content|
36
40
  write_file(file_name, unescape_text(file_content))
37
41
  chmod(file_mode, file_name)
38
42
  end
@@ -45,7 +49,8 @@ Given(/^(?:an|the) empty file(?: named)? "([^"]*)"$/) do |file_name|
45
49
  write_file(file_name, '')
46
50
  end
47
51
 
48
- Given(/^(?:an|the) empty file(?: named)? "([^"]*)" with mode "([^"]*)"$/) do |file_name, file_mode|
52
+ Given(/^(?:an|the) empty file(?: named)? "([^"]*)" with mode "([^"]*)"$/) \
53
+ do |file_name, file_mode|
49
54
  write_file(file_name, '')
50
55
  chmod(file_mode, file_name)
51
56
  end
@@ -54,7 +59,8 @@ When(/^I write to "([^"]*)" with:$/) do |file_name, file_content|
54
59
  write_file(file_name, file_content)
55
60
  end
56
61
 
57
- When(/^I overwrite(?: (?:a|the) file(?: named)?)? "([^"]*)" with:$/) do |file_name, file_content|
62
+ When(/^I overwrite(?: (?:a|the) file(?: named)?)? "([^"]*)" with:$/) \
63
+ do |file_name, file_content|
58
64
  overwrite_file(file_name, file_content)
59
65
  end
60
66
 
@@ -66,7 +72,8 @@ When(/^I append to "([^"]*)" with "([^"]*)"$/) do |file_name, file_content|
66
72
  append_to_file(file_name, file_content)
67
73
  end
68
74
 
69
- When(/^I remove (?:a|the) (?:file|directory)(?: named)? "([^"]*)"( with full force)?$/) do |name, force_remove|
75
+ When(/^I remove (?:a|the) (?:file|directory)(?: named)? "([^"]*)"( with full force)?$/) \
76
+ do |name, force_remove|
70
77
  remove(name, force: force_remove.nil? ? false : true)
71
78
  end
72
79
 
@@ -88,7 +95,8 @@ Then(/^the following files should (not )?exist:$/) do |negated, files|
88
95
  end
89
96
  end
90
97
 
91
- Then(/^(?:a|the) file(?: named)? "([^"]*)" should (not )?exist(?: anymore)?$/) do |path, expect_match|
98
+ Then(/^(?:a|the) file(?: named)? "([^"]*)" should (not )?exist(?: anymore)?$/) \
99
+ do |path, expect_match|
92
100
  if expect_match
93
101
  expect(path).not_to be_an_existing_file
94
102
  else
@@ -96,7 +104,8 @@ Then(/^(?:a|the) file(?: named)? "([^"]*)" should (not )?exist(?: anymore)?$/) d
96
104
  end
97
105
  end
98
106
 
99
- Then(/^(?:a|the) directory(?: named)? "([^"]*)" should (not )?exist(?: anymore)?$/) do |path, expect_match|
107
+ Then(/^(?:a|the) directory(?: named)? "([^"]*)" should (not )?exist(?: anymore)?$/) \
108
+ do |path, expect_match|
100
109
  if expect_match
101
110
  expect(path).not_to be_an_existing_directory
102
111
  else
@@ -112,7 +121,8 @@ Then(/^(?:a|the) file matching %r<(.*?)> should (not )?exist$/) do |pattern, exp
112
121
  end
113
122
  end
114
123
 
115
- Then(/^(?:a|the) (\d+) byte file(?: named)? "([^"]*)" should (not )?exist$/) do |size, file, negated|
124
+ Then(/^(?:a|the) (\d+) byte file(?: named)? "([^"]*)" should (not )?exist$/) \
125
+ do |size, file, negated|
116
126
  if negated
117
127
  expect(file).not_to have_file_size(size)
118
128
  else
@@ -130,7 +140,8 @@ Then(/^the following directories should (not )?exist:$/) do |negated, directorie
130
140
  end
131
141
  end
132
142
 
133
- Then(/^(?:a|the) file(?: named)? "([^"]*)" should (not )?contain "([^"]*)"$/) do |file, negated, content|
143
+ Then(/^(?:a|the) file(?: named)? "([^"]*)" should (not )?contain "([^"]*)"$/) \
144
+ do |file, negated, content|
134
145
  if negated
135
146
  expect(file).not_to have_file_content file_content_including(content.chomp)
136
147
  else
@@ -138,7 +149,8 @@ Then(/^(?:a|the) file(?: named)? "([^"]*)" should (not )?contain "([^"]*)"$/) do
138
149
  end
139
150
  end
140
151
 
141
- Then(/^(?:a|the) file(?: named)? "([^"]*)" should (not )?contain:$/) do |file, negated, content|
152
+ Then(/^(?:a|the) file(?: named)? "([^"]*)" should (not )?contain:$/) \
153
+ do |file, negated, content|
142
154
  if negated
143
155
  expect(file).not_to have_file_content file_content_including(content.chomp)
144
156
  else
@@ -146,7 +158,8 @@ Then(/^(?:a|the) file(?: named)? "([^"]*)" should (not )?contain:$/) do |file, n
146
158
  end
147
159
  end
148
160
 
149
- Then(/^(?:a|the) file(?: named)? "([^"]*)" should (not )?contain exactly:$/) do |file, negated, content|
161
+ Then(/^(?:a|the) file(?: named)? "([^"]*)" should (not )?contain exactly:$/) \
162
+ do |file, negated, content|
150
163
  if negated
151
164
  expect(file).not_to have_file_content content
152
165
  else
@@ -154,7 +167,8 @@ Then(/^(?:a|the) file(?: named)? "([^"]*)" should (not )?contain exactly:$/) do
154
167
  end
155
168
  end
156
169
 
157
- Then(/^(?:a|the) file(?: named)? "([^"]*)" should (not )?match %r<([^>]*)>$/) do |file, negated, content|
170
+ Then(/^(?:a|the) file(?: named)? "([^"]*)" should (not )?match %r<([^>]*)>$/) \
171
+ do |file, negated, content|
158
172
  if negated
159
173
  expect(file).not_to have_file_content file_content_matching(content)
160
174
  else
@@ -162,7 +176,8 @@ Then(/^(?:a|the) file(?: named)? "([^"]*)" should (not )?match %r<([^>]*)>$/) do
162
176
  end
163
177
  end
164
178
 
165
- Then(/^(?:a|the) file(?: named)? "([^"]*)" should (not )?match \/([^\/]*)\/$/) do |file, negated, content|
179
+ Then(%r{^(?:a|the) file(?: named)? "([^"]*)" should (not )?match /([^/]*)/$}) \
180
+ do |file, negated, content|
166
181
  if negated
167
182
  expect(file).not_to have_file_content file_content_matching(content)
168
183
  else
@@ -170,7 +185,8 @@ Then(/^(?:a|the) file(?: named)? "([^"]*)" should (not )?match \/([^\/]*)\/$/) d
170
185
  end
171
186
  end
172
187
 
173
- Then(/^(?:a|the) file(?: named)? "([^"]*)" should (not )?be equal to file "([^"]*)"/) do |file, negated, reference_file|
188
+ Then(/^(?:a|the) file(?: named)? "([^"]*)" should (not )?be equal to file "([^"]*)"/) \
189
+ do |file, negated, reference_file|
174
190
  if negated
175
191
  expect(file).not_to have_same_file_content_as(reference_file)
176
192
  else
@@ -178,10 +194,14 @@ Then(/^(?:a|the) file(?: named)? "([^"]*)" should (not )?be equal to file "([^"]
178
194
  end
179
195
  end
180
196
 
181
- Then(/^(?:a|the) (?:file|directory)(?: named)? "([^"]*)" should( not)? have permissions "([^"]*)"$/) do |path, negated, permissions|
182
- if negated
183
- expect(path).not_to have_permissions(permissions)
184
- else
185
- expect(path).to have_permissions(permissions)
186
- end
197
+ Then(
198
+ /^(?:a|the) (?:file|directory)(?: named)? "([^"]*)" should have permissions "([^"]*)"$/
199
+ ) do |path, permissions|
200
+ expect(path).to have_permissions(permissions)
201
+ end
202
+
203
+ Then(
204
+ /^(?:a|the) (?:file|directory)(?: named)? "([^"]*)" should not have permissions "([^"]*)"$/
205
+ ) do |path, permissions|
206
+ expect(path).not_to have_permissions(permissions)
187
207
  end
@@ -9,7 +9,10 @@ end
9
9
 
10
10
  Before do
11
11
  # ... so every change needs to be done later
12
- prepend_environment_variable 'PATH', aruba.config.command_search_paths.join(File::PATH_SEPARATOR) + File::PATH_SEPARATOR
12
+ prepend_environment_variable(
13
+ 'PATH',
14
+ aruba.config.command_search_paths.join(File::PATH_SEPARATOR) + File::PATH_SEPARATOR
15
+ )
13
16
  set_environment_variable 'HOME', aruba.config.home_directory
14
17
  end
15
18
 
@@ -1,18 +1,18 @@
1
1
  # Cucumber
2
- Then /^the feature(?:s)? should not(?: all)? pass$/ do
2
+ Then(/^the feature(?:s)? should not(?: all)? pass$/) do
3
3
  step 'the output should contain " failed)"'
4
4
  step 'the exit status should be 1'
5
5
  end
6
6
 
7
7
  # Cucumber
8
- Then /^the feature(?:s)? should(?: all)? pass$/ do
8
+ Then(/^the feature(?:s)? should(?: all)? pass$/) do
9
9
  step 'the output should not contain " failed)"'
10
10
  step 'the output should not contain " undefined)"'
11
11
  step 'the exit status should be 0'
12
12
  end
13
13
 
14
14
  # Cucumber
15
- Then /^the feature(?:s)? should not(?: all)? pass with( regex)?:$/ do |regex, string|
15
+ Then(/^the feature(?:s)? should not(?: all)? pass with( regex)?:$/) do |regex, string|
16
16
  step 'the output should contain " failed)"'
17
17
  step 'the exit status should be 1'
18
18
 
@@ -24,7 +24,7 @@ Then /^the feature(?:s)? should not(?: all)? pass with( regex)?:$/ do |regex, st
24
24
  end
25
25
 
26
26
  # Cucumber
27
- Then /^the feature(?:s)? should(?: all)? pass with( regex)?:$/ do |regex, string|
27
+ Then(/^the feature(?:s)? should(?: all)? pass with( regex)?:$/) do |regex, string|
28
28
  step 'the output should not contain " failed)"'
29
29
  step 'the output should not contain " undefined)"'
30
30
  step 'the exit status should be 0'
@@ -37,7 +37,8 @@ Then /^the feature(?:s)? should(?: all)? pass with( regex)?:$/ do |regex, string
37
37
  end
38
38
 
39
39
  # RSpec
40
- Then /^the spec(?:s)? should not(?: all)? pass(?: with (\d+) failures?)?$/ do |count_failures|
40
+ Then(/^the spec(?:s)? should not(?: all)? pass(?: with (\d+) failures?)?$/) \
41
+ do |count_failures|
41
42
  if count_failures.nil?
42
43
  step 'the output should not contain "0 failures"'
43
44
  else
@@ -48,13 +49,13 @@ Then /^the spec(?:s)? should not(?: all)? pass(?: with (\d+) failures?)?$/ do |c
48
49
  end
49
50
 
50
51
  # RSpec
51
- Then /^the spec(?:s)? should all pass$/ do
52
+ Then(/^the spec(?:s)? should all pass$/) do
52
53
  step 'the output should contain "0 failures"'
53
54
  step 'the exit status should be 0'
54
55
  end
55
56
 
56
57
  # RSpec
57
- Then /^the spec(?:s)? should not(?: all)? pass with( regex)?:$/ do |regex, string|
58
+ Then(/^the spec(?:s)? should not(?: all)? pass with( regex)?:$/) do |regex, string|
58
59
  step 'the output should not contain "0 failures"'
59
60
  step 'the exit status should be 1'
60
61
 
@@ -66,7 +67,7 @@ Then /^the spec(?:s)? should not(?: all)? pass with( regex)?:$/ do |regex, strin
66
67
  end
67
68
 
68
69
  # RSpec
69
- Then /^the spec(?:s)? should(?: all)? pass with( regex)?:$/ do |regex, string|
70
+ Then(/^the spec(?:s)? should(?: all)? pass with( regex)?:$/) do |regex, string|
70
71
  step 'the output should contain "0 failures"'
71
72
  step 'the exit status should be 0'
72
73
 
@@ -78,7 +79,8 @@ Then /^the spec(?:s)? should(?: all)? pass with( regex)?:$/ do |regex, string|
78
79
  end
79
80
 
80
81
  # Minitest
81
- Then /^the tests(?:s)? should not(?: all)? pass(?: with (\d+) failures?)?$/ do |count_failures|
82
+ Then(/^the tests(?:s)? should not(?: all)? pass(?: with (\d+) failures?)?$/) \
83
+ do |count_failures|
82
84
  if count_failures.nil?
83
85
  step 'the output should not contain "0 errors"'
84
86
  else
@@ -89,13 +91,13 @@ Then /^the tests(?:s)? should not(?: all)? pass(?: with (\d+) failures?)?$/ do |
89
91
  end
90
92
 
91
93
  # Minitest
92
- Then /^the tests(?:s)? should all pass$/ do
94
+ Then(/^the tests(?:s)? should all pass$/) do
93
95
  step 'the output should contain "0 errors"'
94
96
  step 'the exit status should be 0'
95
97
  end
96
98
 
97
99
  # Minitest
98
- Then /^the test(?:s)? should not(?: all)? pass with( regex)?:$/ do |regex, string|
100
+ Then(/^the test(?:s)? should not(?: all)? pass with( regex)?:$/) do |regex, string|
99
101
  step 'the output should contain "0 errors"'
100
102
  step 'the exit status should be 1'
101
103
 
@@ -107,7 +109,7 @@ Then /^the test(?:s)? should not(?: all)? pass with( regex)?:$/ do |regex, strin
107
109
  end
108
110
 
109
111
  # Minitest
110
- Then /^the test(?:s)? should(?: all)? pass with( regex)?:$/ do |regex, string|
112
+ Then(/^the test(?:s)? should(?: all)? pass with( regex)?:$/) do |regex, string|
111
113
  step 'the output should not contain "0 errors"'
112
114
  step 'the exit status should be 0'
113
115
 
@@ -33,7 +33,9 @@ module Aruba
33
33
  def register(event_ids, handler_object = nil, &handler_proc)
34
34
  handler = handler_proc || handler_object
35
35
 
36
- fail ArgumentError, 'Please pass either an object#call or a handler block' if handler.nil? || !handler.respond_to?(:call)
36
+ if handler.nil? || !handler.respond_to?(:call)
37
+ raise ArgumentError, 'Please pass either an object#call or a handler block'
38
+ end
37
39
 
38
40
  Array(event_ids).flatten.each do |id|
39
41
  @handlers[
@@ -51,7 +53,7 @@ module Aruba
51
53
  # handler.
52
54
  #
53
55
  def notify(event)
54
- fail NoEventError, 'Please pass an event object, not a class' if event.is_a?(Class)
56
+ raise NoEventError, 'Please pass an event object, not a class' if event.is_a?(Class)
55
57
 
56
58
  @handlers[event.class.to_s].each { |handler| handler.call(event) }
57
59
  end
@@ -15,11 +15,11 @@ module Aruba
15
15
 
16
16
  # Thanks ActiveSupport
17
17
  # (Only needed to support Ruby 1.9.3 and JRuby)
18
- # rubocop:disable Metrics/CyclomaticComplexity
19
18
  def constantize(camel_cased_word)
20
19
  names = camel_cased_word.split('::')
21
20
 
22
- # Trigger a built-in NameError exception including the ill-formed constant in the message.
21
+ # Trigger a built-in NameError exception including the ill-formed
22
+ # constant in the message.
23
23
  Object.const_get(camel_cased_word) if names.empty?
24
24
 
25
25
  # Remove the first blank element in case of '::ClassName' notation.
@@ -49,7 +49,6 @@ module Aruba
49
49
  end
50
50
  end
51
51
  end
52
- # rubocop:enable Metrics/CyclomaticComplexity
53
52
  end
54
53
 
55
54
  # @private
@@ -120,7 +119,8 @@ module Aruba
120
119
  class FailingResolver
121
120
  class << self
122
121
  def match?(event_id)
123
- fail ArgumentError, %(Input type "#{event_id.class}" of event_id "#{event_id}" is invalid)
122
+ raise ArgumentError,
123
+ %(Input type "#{event_id.class}" of event_id "#{event_id}" is invalid)
124
124
  end
125
125
 
126
126
  def supports
@@ -147,10 +147,11 @@ module Aruba
147
147
 
148
148
  def transform(event_id)
149
149
  resolvers.find { |r| r.match? event_id }.new.transform(default_namespace, event_id)
150
- rescue => e
151
- # rubocop:disable Layout/LineLength
152
- raise EventNameResolveError, %(Transforming "#{event_id}" into an event class failed. Supported types are: #{@resolvers.map(&:supports).flatten.join(', ')}. #{e.message}.\n\n#{e.backtrace.join("\n")})
153
- # rubocop:enable Layout/LineLength
150
+ rescue StandardError => e
151
+ types = @resolvers.map(&:supports).flatten.join(', ')
152
+ message = "Transforming \"#{event_id}\" into an event class failed." \
153
+ " Supported types are: #{types}. #{e.message}."
154
+ raise EventNameResolveError, message, cause: e
154
155
  end
155
156
  end
156
157
  end
@@ -4,7 +4,8 @@ module Aruba
4
4
  module Events
5
5
  # Basic event
6
6
  #
7
- # This is not meant for direct use - BasicEvent.new - by users. It is inherited by normal events
7
+ # This is not meant for direct use - BasicEvent.new - by users. It is
8
+ # inherited by normal events
8
9
  #
9
10
  # @private
10
11
  class BasicEvent
@@ -21,12 +21,10 @@ module Aruba
21
21
  # @param [Proc] block
22
22
  # The block which should be run for the hook
23
23
  def append(label, block)
24
- if store.key?(label.to_sym) && store[label.to_sym].respond_to?(:<<)
25
- store[label.to_sym] << block
26
- else
24
+ unless store.key?(label.to_sym) && store[label.to_sym].respond_to?(:<<)
27
25
  store[label.to_sym] = []
28
- store[label.to_sym] << block
29
26
  end
27
+ store[label.to_sym] << block
30
28
  end
31
29
 
32
30
  # Run hook
@@ -15,14 +15,17 @@ module Aruba
15
15
  end
16
16
 
17
17
  def method_missing(name, *args)
18
- fail ArgumentError, 'Options take no argument' if args.any?
19
- fail UnknownOptionError, %(Option "#{name}" is unknown. Please use only earlier defined options) unless config.key? name
18
+ if config.key? name
19
+ raise ArgumentError, 'Options take no argument' if args.any?
20
20
 
21
- config[name]
21
+ config[name]
22
+ else
23
+ super
24
+ end
22
25
  end
23
26
 
24
- def respond_to_missing?(*)
25
- true
27
+ def respond_to_missing?(name, _include_private)
28
+ config.key? name
26
29
  end
27
30
  end
28
31
  end
@@ -23,7 +23,8 @@ module Aruba
23
23
  end
24
24
 
25
25
  content = if File.exist? file
26
- file_ends_with_carriage_return = File.open(file, 'r').readlines.last.match(/.*\n$/)
26
+ file_ends_with_carriage_return =
27
+ File.open(file, 'r').readlines.last.match(/.*\n$/)
27
28
 
28
29
  prefix = file_ends_with_carriage_return ? '' : "\n"
29
30
 
@@ -53,7 +54,8 @@ module Aruba
53
54
  end
54
55
 
55
56
  def start(*)
56
- fail ArgumentError, %(Unknown test framework. Please use one of :rspec, :cucumber or :minitest)
57
+ raise ArgumentError,
58
+ %(Unknown test framework. Please use one of :rspec, :cucumber or :minitest)
57
59
  end
58
60
  end
59
61
  end
@@ -206,7 +208,7 @@ module Aruba
206
208
  begin
207
209
  initializers.find { |i| i.match? test_framework }.start [], {}
208
210
  rescue ArgumentError => e
209
- $stderr.puts e.message
211
+ warn e.message
210
212
  exit 0
211
213
  end
212
214
 
@@ -33,6 +33,8 @@ module Aruba
33
33
 
34
34
  # @private
35
35
  module HashFormatting
36
+ module_function
37
+
36
38
  # `{ :a => 5, :b => 2 }.inspect` produces:
37
39
  #
38
40
  # {:a=>5, :b=>2}
@@ -45,7 +47,6 @@ module Aruba
45
47
  def improve_hash_formatting(inspect_string)
46
48
  inspect_string.gsub(/(\S)=>(\S)/, '\1 => \2')
47
49
  end
48
- module_function :improve_hash_formatting
49
50
  end
50
51
 
51
52
  include HashFormatting
@@ -70,16 +71,6 @@ module Aruba
70
71
  def failure_message_when_negated
71
72
  "expected #{description_of @actual} not to #{description}"
72
73
  end
73
-
74
- # @private
75
- # rubocop:disable Naming/PredicateName
76
- def self.has_default_failure_messages?(matcher)
77
- matcher.method(:failure_message).owner == self &&
78
- matcher.method(:failure_message_when_negated).owner == self
79
- rescue NameError
80
- false
81
- end
82
- # rubocop:enable Naming/PredicateName
83
74
  end
84
75
 
85
76
  include DefaultFailureMessages