summaryrefslogtreecommitdiff
path: root/spec/models
diff options
context:
space:
mode:
authorKamil Trzcinski <ayufan@ayufan.eu>2016-02-19 20:12:56 +0100
committerJames Edwards-Jones <jedwardsjones@gitlab.com>2017-01-31 22:55:28 +0000
commit06d96a9a624d31294bdf16a4662aaa7121274061 (patch)
treedc6c17d67fa7894b632ac51d48f94dbaf6732e12 /spec/models
parent8a861c87bf8ba71d5c1a479c8118d9ed6aaf8e88 (diff)
downloadgitlab-ce-06d96a9a624d31294bdf16a4662aaa7121274061.tar.gz
Introduce pages_deployed? to Project model
Diffstat (limited to 'spec/models')
-rw-r--r--spec/models/project_spec.rb23
1 files changed, 17 insertions, 6 deletions
diff --git a/spec/models/project_spec.rb b/spec/models/project_spec.rb
index bb4d82a4df1..558674b5b39 100644
--- a/spec/models/project_spec.rb
+++ b/spec/models/project_spec.rb
@@ -1068,6 +1068,23 @@ 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 { FileUtils.mkdir_p(project.public_pages_path) }
+ after { FileUtils.rmdir(project.public_pages_path) }
+
+ 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') }
@@ -1854,16 +1871,10 @@ describe Project, models: true do
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' }