summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVitaliy @blackst0ne Klachkov <blackst0ne.ru@gmail.com>2017-09-10 12:46:58 +1100
committerVitaliy @blackst0ne Klachkov <blackst0ne.ru@gmail.com>2017-09-10 12:46:58 +1100
commit094add464e7edb9490422ae3e01c1577340840aa (patch)
tree1a7d3db1e73ff93c51c4a3bfda6fc5aa3d0d2681
parent5d952f756bcf0355fc5d86d819dfc6913c0ae351 (diff)
downloadgitlab-ce-094add464e7edb9490422ae3e01c1577340840aa.tar.gz
Replace project/group_links.feature spinach test with an rspec analog
-rw-r--r--changelogs/unreleased/replace_group_links-feature.yml5
-rw-r--r--features/project/group_links.feature16
-rw-r--r--features/steps/project/project_group_links.rb51
-rw-r--r--spec/features/projects/settings/user_manages_group_links_spec.rb41
4 files changed, 46 insertions, 67 deletions
diff --git a/changelogs/unreleased/replace_group_links-feature.yml b/changelogs/unreleased/replace_group_links-feature.yml
new file mode 100644
index 00000000000..7dd157632c9
--- /dev/null
+++ b/changelogs/unreleased/replace_group_links-feature.yml
@@ -0,0 +1,5 @@
+---
+title: Replace project/group_links.feature spinach test with an rspec analog
+merge_request: 14169
+author: Vitaliy @blackst0ne Klachkov
+type: other
diff --git a/features/project/group_links.feature b/features/project/group_links.feature
deleted file mode 100644
index 2657c4487ad..00000000000
--- a/features/project/group_links.feature
+++ /dev/null
@@ -1,16 +0,0 @@
-Feature: Project Group Links
- Background:
- Given I sign in as a user
- And I own project "Shop"
- And project "Shop" is shared with group "Ops"
- And project "Shop" is not shared with group "Market"
- And I visit project group links page
-
- Scenario: I should see list of groups
- Then I should see project already shared with group "Ops"
- Then I should see project is not shared with group "Market"
-
- @javascript
- Scenario: I share project with group
- When I select group "Market" for share
- Then I should see project is shared with group "Market"
diff --git a/features/steps/project/project_group_links.rb b/features/steps/project/project_group_links.rb
deleted file mode 100644
index 47ee31786a6..00000000000
--- a/features/steps/project/project_group_links.rb
+++ /dev/null
@@ -1,51 +0,0 @@
-class Spinach::Features::ProjectGroupLinks < Spinach::FeatureSteps
- include SharedAuthentication
- include SharedProject
- include SharedPaths
- include Select2Helper
-
- step 'I should see project already shared with group "Ops"' do
- page.within '.project-members-groups' do
- expect(page).to have_content "Ops"
- end
- end
-
- step 'I should see project is not shared with group "Market"' do
- page.within '.project-members-groups' do
- expect(page).not_to have_content "Market"
- end
- end
-
- step 'I select group "Market" for share' do
- click_link 'Share with group'
- group = Group.find_by(path: 'market')
- select2(group.id, from: "#link_group_id")
- select "Master", from: 'link_group_access'
- click_button "Share"
- end
-
- step 'I should see project is shared with group "Market"' do
- page.within '.project-members-groups' do
- expect(page).to have_content "Market"
- end
- end
-
- step 'project "Shop" is shared with group "Ops"' do
- group = create(:group, name: 'Ops')
- share_link = project.project_group_links.new(group_access: Gitlab::Access::MASTER)
- share_link.group_id = group.id
- share_link.save!
- end
-
- step 'project "Shop" is not shared with group "Market"' do
- create(:group, name: 'Market', path: 'market')
- end
-
- step 'I visit project group links page' do
- visit project_group_links_path(project)
- end
-
- def project
- @project ||= Project.find_by_name "Shop"
- end
-end
diff --git a/spec/features/projects/settings/user_manages_group_links_spec.rb b/spec/features/projects/settings/user_manages_group_links_spec.rb
new file mode 100644
index 00000000000..91e8059865c
--- /dev/null
+++ b/spec/features/projects/settings/user_manages_group_links_spec.rb
@@ -0,0 +1,41 @@
+require 'spec_helper'
+
+describe 'User manages group links' do
+ include Select2Helper
+
+ let(:user) { create(:user) }
+ let(:project) { create(:project, namespace: user.namespace) }
+ let(:group_ops) { create(:group, name: 'Ops') }
+ let(:group_market) { create(:group, name: 'Market', path: 'market') }
+
+ before do
+ project.add_master(user)
+ sign_in(user)
+
+ share_link = project.project_group_links.new(group_access: Gitlab::Access::MASTER)
+ share_link.group_id = group_ops.id
+ share_link.save!
+
+ visit(project_group_links_path(project))
+ end
+
+ it 'shows a list of groups' do
+ page.within('.project-members-groups') do
+ expect(page).to have_content('Ops')
+ expect(page).not_to have_content('Market')
+ end
+ end
+
+ it 'shares a project with a group', :js do
+ click_link('Share with group')
+
+ select2(group_market.id, from: '#link_group_id')
+ select('Master', from: 'link_group_access')
+
+ click_button('Share')
+
+ page.within('.project-members-groups') do
+ expect(page).to have_content('Market')
+ end
+ end
+end