Commit edd07e23 authored by Sebastian Klier's avatar Sebastian Klier

Fix wiki tests

parent ca3e1d9e
...@@ -11,7 +11,7 @@ module WikiPages ...@@ -11,7 +11,7 @@ module WikiPages
repository: @project.hook_attrs.slice(:name, :url, :description, :homepage) repository: @project.hook_attrs.slice(:name, :url, :description, :homepage)
} }
page_url = Gitlab::UrlBuilder.new(:wiki_page).build(page) page_url = Gitlab::UrlBuilder.build(page)
hook_data[:object_attributes].merge!(url: page_url, action: action) hook_data[:object_attributes].merge!(url: page_url, action: action)
hook_data hook_data
end end
......
FactoryGirl.define do
factory :project_wiki do
project factory: :empty_project
user factory: :user
initialize_with { new(project, user) }
end
end
require 'ostruct'
FactoryGirl.define do
factory :wiki_page do
page = OpenStruct.new(url_path: 'some-name')
association :wiki, factory: :project_wiki, strategy: :build
initialize_with { new(wiki, page, true) }
end
end
...@@ -106,5 +106,14 @@ describe Gitlab::UrlBuilder, lib: true do ...@@ -106,5 +106,14 @@ describe Gitlab::UrlBuilder, lib: true do
end end
end end
end end
context 'when passing a WikiPage' do
it 'returns a proper URL' do
wiki_page = build(:wiki_page)
url = described_class.build(wiki_page)
expect(url).to eq "#{Gitlab.config.gitlab.url}#{wiki_page.wiki.wiki_base_path}/#{wiki_page.slug}"
end
end
end end
end end
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