Commit 6e4d67e0 authored by Sean McGivern's avatar Sean McGivern

Fix hook data specs

parent 95265c08
......@@ -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
......
......@@ -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
......@@ -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
......@@ -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
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment