summaryrefslogtreecommitdiff
path: root/spec/models/project_spec.rb
diff options
context:
space:
mode:
authorKamil Trzcinski <ayufan@ayufan.eu>2016-02-19 15:11:03 +0100
committerJames Edwards-Jones <jedwardsjones@gitlab.com>2017-01-31 22:53:58 +0000
commit492627c987fd167c956df49843e741cbe29fd77a (patch)
tree90156cbe7df8195569ed66926ccb2303b29332bd /spec/models/project_spec.rb
parentc089f103342ae8f60c7fa9055ef79e3245d6a5fb (diff)
downloadgitlab-ce-492627c987fd167c956df49843e741cbe29fd77a.tar.gz
Fix the URL of group pages
Diffstat (limited to 'spec/models/project_spec.rb')
-rw-r--r--spec/models/project_spec.rb33
1 files changed, 33 insertions, 0 deletions
diff --git a/spec/models/project_spec.rb b/spec/models/project_spec.rb
index 5fde9194e93..cf45ee54fa4 100644
--- a/spec/models/project_spec.rb
+++ b/spec/models/project_spec.rb
@@ -1845,4 +1845,37 @@ describe Project, models: true do
def enable_lfs
allow(Gitlab.config.lfs).to receive(:enabled).and_return(true)
end
+
+ describe :pages_url do
+ let(:group) { create :group, name: group_name }
+ let(:project) { create :empty_project, namespace: group, name: project_name }
+ let(:domain) { 'Example.com' }
+
+ subject { project.pages_url }
+
+ before do
+ FileUtils.mkdir_p(project.public_pages_path)
+
+ allow(Settings.pages).to receive(:host).and_return(domain)
+ allow(Gitlab.config.pages).to receive(:url).and_return('http://example.com')
+ end
+
+ after do
+ FileUtils.rmdir(project.public_pages_path)
+ end
+
+ context 'group page' do
+ let(:group_name) { 'Group' }
+ let(:project_name) { 'group.example.com' }
+
+ it { is_expected.to eq("http://group.example.com") }
+ end
+
+ context 'project page' do
+ let(:group_name) { 'Group' }
+ let(:project_name) { 'Project' }
+
+ it { is_expected.to eq("http://group.example.com/project") }
+ end
+ end
end