summaryrefslogtreecommitdiff
path: root/spec/features/projects
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/features/projects
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/features/projects')
-rw-r--r--spec/features/projects/pages_spec.rb60
1 files changed, 60 insertions, 0 deletions
diff --git a/spec/features/projects/pages_spec.rb b/spec/features/projects/pages_spec.rb
new file mode 100644
index 00000000000..11793c0f303
--- /dev/null
+++ b/spec/features/projects/pages_spec.rb
@@ -0,0 +1,60 @@
+require 'spec_helper'
+
+feature 'Pages', feature: true do
+ given(:project) { create(:empty_project) }
+ given(:user) { create(:user) }
+ given(:role) { :master }
+
+ background do
+ allow(Gitlab.config.pages).to receive(:enabled).and_return(true)
+
+ project.team << [user, role]
+
+ login_as(user)
+ end
+
+ shared_examples 'no pages deployed' do
+ scenario 'does not see anything to destroy' do
+ visit namespace_project_pages_path(project.namespace, project)
+
+ expect(page).not_to have_link('Remove pages')
+ expect(page).not_to have_text('Only the project owner can remove pages')
+ end
+ end
+
+ context 'when user is the owner' do
+ background do
+ project.namespace.update(owner: user)
+ end
+
+ context 'when pages deployed' do
+ background do
+ allow_any_instance_of(Project).to receive(:pages_deployed?) { true }
+ end
+
+ scenario 'sees "Remove pages" link' do
+ visit namespace_project_pages_path(project.namespace, project)
+
+ expect(page).to have_link('Remove pages')
+ end
+ end
+
+ it_behaves_like 'no pages deployed'
+ end
+
+ context 'when the user is not the owner' do
+ context 'when pages deployed' do
+ background do
+ allow_any_instance_of(Project).to receive(:pages_deployed?) { true }
+ end
+
+ scenario 'sees "Only the project owner can remove pages" text' do
+ visit namespace_project_pages_path(project.namespace, project)
+
+ expect(page).to have_text('Only the project owner can remove pages')
+ end
+ end
+
+ it_behaves_like 'no pages deployed'
+ end
+end