diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-06-06 00:09:04 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-06-06 00:09:04 +0300 |
commit | 96e23b2017cbe56969771960f6c274c5d3599397 (patch) | |
tree | b8b17da1ab080dd41fc64fc0262de2cf16754559 /spec/support | |
parent | 2f1a81fd16ff9968d6b986f8a407d963bc2218f9 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/support')
-rw-r--r-- | spec/support/helpers/markdown_helpers.rb | 7 | ||||
-rw-r--r-- | spec/support/matchers/sourcepos_matchers.rb | 14 |
2 files changed, 21 insertions, 0 deletions
diff --git a/spec/support/helpers/markdown_helpers.rb b/spec/support/helpers/markdown_helpers.rb new file mode 100644 index 00000000000..9a25238465a --- /dev/null +++ b/spec/support/helpers/markdown_helpers.rb @@ -0,0 +1,7 @@ +# frozen_string_literal: true + +module MarkdownHelpers + def remove_sourcepos(html) + html.gsub(/\ ?data-sourcepos=".*?"/, '') + end +end diff --git a/spec/support/matchers/sourcepos_matchers.rb b/spec/support/matchers/sourcepos_matchers.rb new file mode 100644 index 00000000000..903fe2bd201 --- /dev/null +++ b/spec/support/matchers/sourcepos_matchers.rb @@ -0,0 +1,14 @@ +# frozen_string_literal: true + +# remove data-sourcepos from compare +RSpec::Matchers.define :eq_no_sourcepos do |expected| + include MarkdownHelpers + + match do |actual| + remove_sourcepos(actual) == expected + end + + description do + "equal ignoring sourcepos #{expected}" + end +end |