Add latest changes from gitlab-org/gitlab@master
This commit is contained in:
parent
c1063d87e0
commit
23a49ec996
|
@ -71,7 +71,12 @@ module Banzai
|
|||
private
|
||||
|
||||
def random_number
|
||||
@random_number ||= rand(10000)
|
||||
# We allow overriding the randomness with a static value from GITLAB_TEST_FOOTNOTE_ID.
|
||||
# This allows stable generation of example HTML during GLFM Snapshot Testing
|
||||
# (https://docs.gitlab.com/ee/development/gitlab_flavored_markdown/specification_guide/#markdown-snapshot-testing),
|
||||
# and reduces the need for normalization of the example HTML
|
||||
# (https://docs.gitlab.com/ee/development/gitlab_flavored_markdown/specification_guide/#normalization)
|
||||
@random_number ||= ENV.fetch('GITLAB_TEST_FOOTNOTE_ID', rand(10000))
|
||||
end
|
||||
|
||||
def fn_id(num)
|
||||
|
|
|
@ -56,6 +56,19 @@ RSpec.describe Banzai::Filter::FootnoteFilter do
|
|||
it 'properly adds the necessary ids and classes' do
|
||||
expect(doc.to_html).to eq filtered_footnote.strip
|
||||
end
|
||||
|
||||
context 'when GITLAB_TEST_FOOTNOTE_ID is set' do
|
||||
let(:test_footnote_id) { '42' }
|
||||
let(:identifier) { test_footnote_id }
|
||||
|
||||
before do
|
||||
stub_env('GITLAB_TEST_FOOTNOTE_ID', test_footnote_id)
|
||||
end
|
||||
|
||||
it 'uses the test footnote ID instead of a random number' do
|
||||
expect(doc.to_html).to eq filtered_footnote.strip
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
context 'when detecting footnotes' do
|
||||
|
|
Loading…
Reference in New Issue