Skip to content

Commit

Permalink
Add custom cert matcher
Browse files Browse the repository at this point in the history
  • Loading branch information
bastelfreak committed Jul 18, 2024
1 parent dd664d4 commit bf79046
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions spec/support/acceptance/matchers/match_without_whitespace.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# based on https://github.com/theforeman/puppet-certs/blob/master/spec/support/acceptance/matchers/match_without_whitespace.rb

Check failure on line 1 in spec/support/acceptance/matchers/match_without_whitespace.rb

View workflow job for this annotation

GitHub Actions / Puppet / Static validations

Style/FrozenStringLiteralComment: Missing frozen string literal comment.
# https://github.com/theforeman/puppet-certs/commit/6b82334a5661a4e95b8c0604535ec39c991c9787
RSpec::Matchers.define :match_without_whitespace do |expected|
match do |actual|
actual.gsub(/\s*/, '').match?(Regexp.new(expected.source, Regexp::EXTENDED))

Check failure on line 5 in spec/support/acceptance/matchers/match_without_whitespace.rb

View workflow job for this annotation

GitHub Actions / Puppet / Static validations

Style/RegexpLiteral: Use `%r` around regular expression. (https://rubystyle.guide#percent-r)
end

failure_message do |actual|
"Actual:\n\n\s\s#{actual.gsub(/\s*/, '')}\n\nExpected:\n\n\s\s#{expected.source}"

Check failure on line 9 in spec/support/acceptance/matchers/match_without_whitespace.rb

View workflow job for this annotation

GitHub Actions / Puppet / Static validations

Style/RegexpLiteral: Use `%r` around regular expression. (https://rubystyle.guide#percent-r)
end
end

0 comments on commit bf79046

Please sign in to comment.