diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-09-13 00:10:38 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-09-13 00:10:38 +0300 |
commit | 3b69a04945341516a2ed6a291769c50fe04336df (patch) | |
tree | 5910b5f0c80bf98aded05305bbaa7fd30d2742c4 /spec/support/matchers | |
parent | e4cfc16da343c2008053ee09bb6af7145a6924cb (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/support/matchers')
-rw-r--r-- | spec/support/matchers/abort_matcher.rb | 19 |
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 |