Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'spec/support/matchers/abort_matcher.rb')
-rw-r--r--spec/support/matchers/abort_matcher.rb19
1 files changed, 9 insertions, 10 deletions
diff --git a/spec/support/matchers/abort_matcher.rb b/spec/support/matchers/abort_matcher.rb
index 64fed2ca069..140953cdc42 100644
--- a/spec/support/matchers/abort_matcher.rb
+++ b/spec/support/matchers/abort_matcher.rb
@@ -13,17 +13,16 @@ RSpec::Matchers.define :abort_execution do
captured = @captured_stderr.string.chomp
@actual_exit_code = e.status
break false unless e.status == 1
-
- if @message
- if @message.is_a? String
- @message == captured
- elsif @message.is_a? Regexp
- @message.match?(captured)
- else
- raise ArgumentError, 'with_message must be either a String or a Regular Expression'
- end
+ break true unless @message
+
+ case @message
+ when String
+ @message == captured
+ when Regexp
+ @message.match?(captured)
+ else
+ raise ArgumentError, 'with_message must be either a String or a Regular Expression'
end
-
ensure
$stderr = original_stderr
end