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 05f1d86 commit 43ce055
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions spec/support/acceptance/matchers/match_without_whitespace.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# frozen_string_literal: true

# based on https://github.com/theforeman/puppet-certs/blob/master/spec/support/acceptance/matchers/match_without_whitespace.rb
# https://github.com/theforeman/puppet-certs/commit/6b82334a5661a4e95b8c0604535ec39c991c9787
RSpec::Matchers.define :match_without_whitespace do |expected|
match do |actual|
actual.gsub(%r{\s*}, '').match?(Regexp.new(expected.source, Regexp::EXTENDED))
end

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

0 comments on commit 43ce055

Please sign in to comment.