summaryrefslogtreecommitdiff
path: root/spec/models/project_spec.rb
diff options
context:
space:
mode:
authorDouwe Maan <douwe@gitlab.com>2017-02-06 18:20:38 +0000
committerDouwe Maan <douwe@gitlab.com>2017-02-06 18:20:38 +0000
commitc07311d486fd177bff6df8b2f912dc91dcadac4e (patch)
tree614735e4f3d0a495abc2ac84573fc55e4a9bf0db /spec/models/project_spec.rb
parent853314c1936506573f5b6c520fce6fd43b998229 (diff)
parentb988faaf85c8e68d501f242b980e5e79a00e2b15 (diff)
downloadgitlab-ce-c07311d486fd177bff6df8b2f912dc91dcadac4e.tar.gz
Merge branch 'jej-pages-to-ce' into 'master'
Adding GitLab Pages to CE Closes #14605, gitlab-com/infrastructure#1058, gitlab-ee#1333, and #323 See merge request !8463
Diffstat (limited to 'spec/models/project_spec.rb')
-rw-r--r--spec/models/project_spec.rb44
1 files changed, 44 insertions, 0 deletions
diff --git a/spec/models/project_spec.rb b/spec/models/project_spec.rb
index 264a5b04a26..d7e6da02261 100644
--- a/spec/models/project_spec.rb
+++ b/spec/models/project_spec.rb
@@ -60,6 +60,7 @@ describe Project, models: true do
it { is_expected.to have_many(:runners) }
it { is_expected.to have_many(:variables) }
it { is_expected.to have_many(:triggers) }
+ it { is_expected.to have_many(:pages_domains) }
it { is_expected.to have_many(:labels).class_name('ProjectLabel').dependent(:destroy) }
it { is_expected.to have_many(:users_star_projects).dependent(:destroy) }
it { is_expected.to have_many(:environments).dependent(:destroy) }
@@ -1067,6 +1068,22 @@ describe Project, models: true do
end
end
+ describe '#pages_deployed?' do
+ let(:project) { create :empty_project }
+
+ subject { project.pages_deployed? }
+
+ context 'if public folder does exist' do
+ before { allow(Dir).to receive(:exist?).with(project.public_pages_path).and_return(true) }
+
+ it { is_expected.to be_truthy }
+ end
+
+ context "if public folder doesn't exist" do
+ it { is_expected.to be_falsey }
+ end
+ end
+
describe '.search' do
let(:project) { create(:empty_project, description: 'kitten mittens') }
@@ -1844,4 +1861,31 @@ 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
+ allow(Settings.pages).to receive(:host).and_return(domain)
+ allow(Gitlab.config.pages).to receive(:url).and_return('http://example.com')
+ 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