Skip to content
Snippets Groups Projects
Commit 78d847c3 authored by Rémy Coutable's avatar Rémy Coutable
Browse files

Move some specs from MRs to Issues specs

parent 75d41a36
No related branches found
No related tags found
No related merge requests found
@project_merge_requests
Feature: Project Merge Requests Notes
@project_issues
Feature: Project Issues Referenced Merge Requests
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
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 "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 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 lambda user
Given I sign in as "Mary Jane"
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 "John Doe"
Given I sign in as "John Doe"
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 "Private MR 01" related merge request
Then I should see the "Fix NS-01" related merge request
class Spinach::Features::ProjectMergeRequestsNotes < Spinach::FeatureSteps
class Spinach::Features::ProjectIssuesReferencedMergeRequests < Spinach::FeatureSteps
include SharedAuthentication
include SharedIssuable
include SharedProject
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')
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: current_user,
author: project.users.first,
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')
step 'project "Private Library" has "Fix NS-01" open merge request' do
project = Project.find_by(name: 'Private Library')
create(:merge_request,
title: 'Private MR 01',
title: 'Fix NS-01',
source_project: project,
target_project: project,
source_branch: 'fix',
target_branch: 'master',
author: current_user,
author: project.users.first,
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
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: namespace_project_issue_url(issue.project.namespace, issue.project, issue)
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)
Loading
Loading
@@ -62,10 +53,11 @@ class Spinach::Features::ProjectMergeRequestsNotes < Spinach::FeatureSteps
end
end
 
step 'I should see the "Private MR 01" related merge request' do
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("Private MR 01")
expect(page).to have_content("Fix NS-01")
end
end
end
Loading
Loading
@@ -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
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment