diff options
-rw-r--r-- | spec/lib/gitlab/hook_data/issue_builder_spec.rb | 2 | ||||
-rw-r--r-- | spec/lib/gitlab/hook_data/merge_request_builder_spec.rb | 9 | ||||
-rw-r--r-- | spec/models/merge_request_spec.rb | 8 | ||||
-rw-r--r-- | spec/models/wiki_page_spec.rb | 4 |
4 files changed, 12 insertions, 11 deletions
diff --git a/spec/lib/gitlab/hook_data/issue_builder_spec.rb b/spec/lib/gitlab/hook_data/issue_builder_spec.rb index 0e4a1d345f4..60093474f8a 100644 --- a/spec/lib/gitlab/hook_data/issue_builder_spec.rb +++ b/spec/lib/gitlab/hook_data/issue_builder_spec.rb @@ -45,7 +45,7 @@ describe Gitlab::HookData::IssueBuilder do let(:issue_with_description) { create(:issue, description: 'test![Issue_Image](/uploads/abc/Issue_Image.png)') } let(:builder) { described_class.new(issue_with_description) } - it 'adds absolute urls for images in the description' do + it 'sets the image to use an absolute URL' do expect(data[:description]).to eq("test![Issue_Image](#{Settings.gitlab.url}/uploads/abc/Issue_Image.png)") end end diff --git a/spec/lib/gitlab/hook_data/merge_request_builder_spec.rb b/spec/lib/gitlab/hook_data/merge_request_builder_spec.rb index b61614e4790..dd586af6118 100644 --- a/spec/lib/gitlab/hook_data/merge_request_builder_spec.rb +++ b/spec/lib/gitlab/hook_data/merge_request_builder_spec.rb @@ -56,5 +56,14 @@ describe Gitlab::HookData::MergeRequestBuilder do expect(data).to include(:human_time_estimate) expect(data).to include(:human_total_time_spent) end + + context 'when the MR has an image in the description' do + let(:mr_with_description) { create(:merge_request, description: 'test![Issue_Image](/uploads/abc/Issue_Image.png)') } + let(:builder) { described_class.new(mr_with_description) } + + it 'sets the image to use an absolute URL' do + expect(data[:description]).to eq("test![Issue_Image](#{Settings.gitlab.url}/uploads/abc/Issue_Image.png)") + end + end end end diff --git a/spec/models/merge_request_spec.rb b/spec/models/merge_request_spec.rb index da302b5457e..3f028b3bd5c 100644 --- a/spec/models/merge_request_spec.rb +++ b/spec/models/merge_request_spec.rb @@ -2357,12 +2357,4 @@ describe MergeRequest do end end end - - describe '#hook_attrs' do - let(:mr_with_description) { create(:merge_request, description: 'test![Mr_Image](/uploads/abc/Mr_Image.png)') } - - it 'adds absolute urls for images in the description' do - expect(mr_with_description.hook_attrs['description']).to eq("test![Mr_Image](#{Settings.gitlab.url}/uploads/abc/Mr_Image.png)") - end - end end diff --git a/spec/models/wiki_page_spec.rb b/spec/models/wiki_page_spec.rb index c00c628b172..4da6a423d15 100644 --- a/spec/models/wiki_page_spec.rb +++ b/spec/models/wiki_page_spec.rb @@ -557,8 +557,8 @@ describe WikiPage do describe '#hook_attrs' do before do create_page("test page", "test![WikiPage_Image](/uploads/abc/WikiPage_Image.png)") - @page = wiki.wiki.paged("test page") - @wiki_page = WikiPage.new(wiki, @page, true) + @page = wiki.wiki.page(title: "test page") + @wiki_page = described_class.new(wiki, @page, true) end it 'adds absolute urls for images in the content' do |