diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-09-20 02:18:09 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-09-20 02:18:09 +0300 |
commit | 6ed4ec3e0b1340f96b7c043ef51d1b33bbe85fde (patch) | |
tree | dc4d20fe6064752c0bd323187252c77e0a89144b /spec/support/matchers/abort_matcher.rb | |
parent | 9868dae7fc0655bd7ce4a6887d4e6d487690eeed (diff) |
Add latest changes from gitlab-org/gitlab@15-4-stable-eev15.4.0-rc42
Diffstat (limited to 'spec/support/matchers/abort_matcher.rb')
-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 |