summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRémy Coutable <remy@rymai.me>2016-01-13 10:53:36 +0100
committerRémy Coutable <remy@rymai.me>2016-01-13 10:53:36 +0100
commit78d847c38c4fb634e57c04a66ac7ec3c3ad8ec8f (patch)
treeda4dc4fd2c9d94c5aaf8163a9049ee5f5a9a9a61
parent75d41a3657fc32dbc4c783ddd8af951105e8c1df (diff)
downloadgitlab-ce-78d847c38c4fb634e57c04a66ac7ec3c3ad8ec8f.tar.gz
Move some specs from MRs to Issues specsfix/private-referenced-merge-requests
-rw-r--r--features/project/issues/referenced_merge_requests.feature25
-rw-r--r--features/project/merge_requests/notes.feature25
-rw-r--r--features/steps/project/issues/referenced_merge_requests.rb63
-rw-r--r--features/steps/project/merge_requests/notes.rb71
-rw-r--r--features/steps/shared/project.rb7
5 files changed, 95 insertions, 96 deletions
diff --git a/features/project/issues/referenced_merge_requests.feature b/features/project/issues/referenced_merge_requests.feature
new file mode 100644
index 00000000000..5f269493b30
--- /dev/null
+++ b/features/project/issues/referenced_merge_requests.feature
@@ -0,0 +1,25 @@
+@project_issues
+Feature: Project Issues Referenced Merge Requests
+ Background:
+ Given I sign in as "John Doe"
+ And "John Doe" owns public project "Community"
+ And project "Community" has "Public Issue 01" open issue
+ And I logout
+ And I sign in as "Mary Jane"
+ And "Mary Jane" owns private project "Private Library"
+ And project "Private Library" has "Fix NS-01" open merge request
+ And I visit merge request page "Fix NS-01"
+ And I leave a comment referencing issue "Public Issue 01" from project "Private Library"
+ And I logout
+
+ @javascript
+ Scenario: Viewing the public issue as a "John Doe"
+ Given I sign in as "John Doe"
+ When I visit issue page "Public Issue 01"
+ Then I should not see any related merge requests
+
+ @javascript
+ Scenario: Viewing the public issue as "Mary Jane"
+ Given I sign in as "Mary Jane"
+ When I visit issue page "Public Issue 01"
+ Then I should see the "Fix NS-01" related merge request
diff --git a/features/project/merge_requests/notes.feature b/features/project/merge_requests/notes.feature
deleted file mode 100644
index cf337a8fe28..00000000000
--- a/features/project/merge_requests/notes.feature
+++ /dev/null
@@ -1,25 +0,0 @@
-@project_merge_requests
-Feature: Project Merge Requests Notes
- Background:
- Given I sign in as "Mary Jane"
- And I own public project "Public Shop"
- And project "Public Shop" has "Public Issue 01" open issue
- And I logout
- And I sign in as "John Doe"
- And I own private project "Private Library"
- And project "Private Library" has "Private MR 01" open merge request
- And I visit merge request page "Private MR 01"
- And I leave a comment with link to issue "Public Issue 01"
- And I logout
-
- @javascript
- Scenario: Viewing the public issue as a lambda user
- Given I sign in as "Mary Jane"
- When I visit issue page "Public Issue 01"
- Then I should not see any related merge requests
-
- @javascript
- Scenario: Viewing the public issue as "John Doe"
- Given I sign in as "John Doe"
- When I visit issue page "Public Issue 01"
- Then I should see the "Private MR 01" related merge request
diff --git a/features/steps/project/issues/referenced_merge_requests.rb b/features/steps/project/issues/referenced_merge_requests.rb
new file mode 100644
index 00000000000..3b1f3620df9
--- /dev/null
+++ b/features/steps/project/issues/referenced_merge_requests.rb
@@ -0,0 +1,63 @@
+class Spinach::Features::ProjectIssuesReferencedMergeRequests < Spinach::FeatureSteps
+ include SharedAuthentication
+ include SharedIssuable
+ include SharedProject
+ include SharedUser
+
+ step 'project "Community" has "Public Issue 01" open issue' do
+ project = Project.find_by(name: 'Community')
+ create(:issue,
+ title: 'Public Issue 01',
+ project: project,
+ author: project.users.first,
+ description: '# Description header'
+ )
+ end
+
+ step 'project "Private Library" has "Fix NS-01" open merge request' do
+ project = Project.find_by(name: 'Private Library')
+ create(:merge_request,
+ title: 'Fix NS-01',
+ source_project: project,
+ target_project: project,
+ source_branch: 'fix',
+ target_branch: 'master',
+ author: project.users.first,
+ description: '# Description header'
+ )
+ end
+
+ step 'I leave a comment referencing issue "Public Issue 01" from project "Private Library"' do
+ project = Project.find_by(name: 'Private Library')
+ issue = Issue.find_by!(title: 'Public Issue 01')
+
+ page.within(".js-main-target-form") do
+ fill_in "note[note]", with: "##{issue.to_reference(project)}"
+ click_button "Add Comment"
+ end
+ end
+
+ step 'I visit merge request page "Fix NS-01"' do
+ mr = MergeRequest.find_by(title: "Fix NS-01")
+ visit namespace_project_merge_request_path(mr.target_project.namespace, mr.target_project, mr)
+ end
+
+ step 'I visit issue page "Public Issue 01"' do
+ issue = Issue.find_by(title: "Public Issue 01")
+ visit namespace_project_issue_path(issue.project.namespace, issue.project, issue)
+ end
+
+ step 'I should not see any related merge requests' do
+ page.within '.issue-details' do
+ expect(page).not_to have_content('.merge-requests')
+ end
+ end
+
+ step 'I should see the "Fix NS-01" related merge request' do
+ page.within '.merge-requests' do
+ expect(page).to have_content("1 Related Merge Request")
+ expect(page).to have_content("Fix NS-01")
+ end
+ end
+
+end
diff --git a/features/steps/project/merge_requests/notes.rb b/features/steps/project/merge_requests/notes.rb
deleted file mode 100644
index 2c3f70cdc6e..00000000000
--- a/features/steps/project/merge_requests/notes.rb
+++ /dev/null
@@ -1,71 +0,0 @@
-class Spinach::Features::ProjectMergeRequestsNotes < Spinach::FeatureSteps
- include SharedAuthentication
- include SharedUser
-
- step 'I own public project "Public Shop"' do
- project = create :project, :public, name: 'Public Shop', namespace: current_user.namespace
- project.team << [current_user, :master]
- end
-
- step 'project "Public Shop" has "Public Issue 01" open issue' do
- project = Project.find_by(name: 'Public Shop')
-
- create(:issue,
- title: 'Public Issue 01',
- project: project,
- author: current_user,
- description: '# Description header'
- )
- end
-
- step 'I own private project "Private Library"' do
- project = create :project, name: 'Private Library', namespace: current_user.namespace
- project.team << [current_user, :master]
- end
-
- step 'project "Private Library" has "Private MR 01" open merge request' do
- project = Project.find_by!(name: 'Private Library')
-
- create(:merge_request,
- title: 'Private MR 01',
- source_project: project,
- target_project: project,
- source_branch: 'fix',
- target_branch: 'master',
- author: current_user,
- description: '# Description header'
- )
- end
-
- step 'I visit merge request page "Private MR 01"' do
- mr = MergeRequest.find_by(title: "Private MR 01")
- visit namespace_project_merge_request_path(mr.target_project.namespace, mr.target_project, mr)
- end
-
- step 'I leave a comment with link to issue "Public Issue 01"' do
- issue = Issue.find_by!(title: 'Public Issue 01')
-
- page.within(".js-main-target-form") do
- fill_in "note[note]", with: namespace_project_issue_url(issue.project.namespace, issue.project, issue)
- click_button "Add Comment"
- end
- end
-
- step 'I visit issue page "Public Issue 01"' do
- issue = Issue.find_by(title: "Public Issue 01")
- visit namespace_project_issue_path(issue.project.namespace, issue.project, issue)
- end
-
- step 'I should not see any related merge requests' do
- page.within '.issue-details' do
- expect(page).not_to have_content('.merge-requests')
- end
- end
-
- step 'I should see the "Private MR 01" related merge request' do
- page.within '.merge-requests' do
- expect(page).to have_content("1 Related Merge Request")
- expect(page).to have_content("Private MR 01")
- end
- end
-end
diff --git a/features/steps/shared/project.rb b/features/steps/shared/project.rb
index da643bf3ba9..43a15f43470 100644
--- a/features/steps/shared/project.rb
+++ b/features/steps/shared/project.rb
@@ -181,6 +181,13 @@ module SharedProject
project.team << [user, :master]
end
+ step '"Mary Jane" owns private project "Private Library"' do
+ user = user_exists('Mary Jane', username: 'mary_jane')
+ project = Project.find_by(name: 'Private Library')
+ project ||= create(:project, name: 'Private Library', namespace: user.namespace)
+ project.team << [user, :master]
+ end
+
step 'public empty project "Empty Public Project"' do
create :project_empty_repo, :public, name: "Empty Public Project"
end