Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boxiang Sun
gitlab-ce
Commits
5373a5b1
Commit
5373a5b1
authored
May 10, 2018
by
blackst0ne
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Replace `features/project/merge_requests/references.featue`
parent
0d77be07
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
60 additions
and
131 deletions
+60
-131
features/project/merge_requests/references.feature
features/project/merge_requests/references.feature
+0
-31
features/steps/shared/authentication.rb
features/steps/shared/authentication.rb
+0
-12
features/steps/shared/issuable.rb
features/steps/shared/issuable.rb
+0
-61
features/steps/shared/note.rb
features/steps/shared/note.rb
+0
-4
features/steps/shared/project.rb
features/steps/shared/project.rb
+0
-23
spec/features/issuables/markdown_references/internal_references_spec.rb
...issuables/markdown_references/internal_references_spec.rb
+60
-0
No files found.
features/project/merge_requests/references.feature
deleted
100644 → 0
View file @
0d77be07
@project_merge_requests
Feature
:
Project Merge Requests References
Background
:
Given
I sign in as
"John Doe"
And
public project
"Community"
And
"John Doe"
owns public project
"Community"
And
project
"Community"
has
"Community fix"
open merge request
And
I logout
And
I sign in as
"Mary Jane"
And
private project
"Enterprise"
And
"Mary Jane"
owns private project
"Enterprise"
And
project
"Enterprise"
has
"Enterprise issue"
open issue
And
project
"Enterprise"
has
"Enterprise fix"
open merge request
And
I visit issue page
"Enterprise issue"
And
I leave a comment referencing issue
"Community fix"
And
I visit merge request page
"Enterprise fix"
And
I leave a comment referencing issue
"Community fix"
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
"Community fix"
Then
I should see no notes at all
@javascript
Scenario
:
Viewing the public issue as "Mary Jane"
Given
I sign in as
"Mary Jane"
When
I visit issue page
"Community fix"
And
I should see a note linking to
"Enterprise fix"
merge request
And
I should see a note linking to
"Enterprise issue"
issue
features/steps/shared/authentication.rb
View file @
5373a5b1
...
@@ -22,22 +22,10 @@ module SharedAuthentication
...
@@ -22,22 +22,10 @@ module SharedAuthentication
sign_in
(
@user
)
sign_in
(
@user
)
end
end
step
'I sign in as "John Doe"'
do
gitlab_sign_in
(
user_exists
(
"John Doe"
))
end
step
'I sign in as "Mary Jane"'
do
gitlab_sign_in
(
user_exists
(
"Mary Jane"
))
end
step
'I should be redirected to sign in page'
do
step
'I should be redirected to sign in page'
do
expect
(
current_path
).
to
eq
new_user_session_path
expect
(
current_path
).
to
eq
new_user_session_path
end
end
step
"I logout"
do
gitlab_sign_out
end
step
"I logout directly"
do
step
"I logout directly"
do
gitlab_sign_out
gitlab_sign_out
end
end
...
...
features/steps/shared/issuable.rb
View file @
5373a5b1
...
@@ -5,29 +5,6 @@ module SharedIssuable
...
@@ -5,29 +5,6 @@ module SharedIssuable
find
(
'.js-issuable-edit'
,
visible:
true
).
click
find
(
'.js-issuable-edit'
,
visible:
true
).
click
end
end
step
'project "Community" has "Community fix" open merge request'
do
create_issuable_for_project
(
project_name:
'Community'
,
type: :merge_request
,
title:
'Community fix'
)
end
step
'project "Enterprise" has "Enterprise issue" open issue'
do
create_issuable_for_project
(
project_name:
'Enterprise'
,
title:
'Enterprise issue'
)
end
step
'project "Enterprise" has "Enterprise fix" open merge request'
do
create_issuable_for_project
(
project_name:
'Enterprise'
,
type: :merge_request
,
title:
'Enterprise fix'
)
end
step
'I leave a comment referencing issue "Community issue"'
do
step
'I leave a comment referencing issue "Community issue"'
do
leave_reference_comment
(
leave_reference_comment
(
issuable:
Issue
.
find_by
(
title:
'Community issue'
),
issuable:
Issue
.
find_by
(
title:
'Community issue'
),
...
@@ -35,44 +12,6 @@ module SharedIssuable
...
@@ -35,44 +12,6 @@ module SharedIssuable
)
)
end
end
step
'I leave a comment referencing issue "Community fix"'
do
leave_reference_comment
(
issuable:
MergeRequest
.
find_by
(
title:
'Community fix'
),
from_project_name:
'Enterprise'
)
end
step
'I visit issue page "Enterprise issue"'
do
issue
=
Issue
.
find_by
(
title:
'Enterprise issue'
)
visit
project_issue_path
(
issue
.
project
,
issue
)
end
step
'I visit merge request page "Enterprise fix"'
do
mr
=
MergeRequest
.
find_by
(
title:
'Enterprise fix'
)
visit
project_merge_request_path
(
mr
.
target_project
,
mr
)
end
step
'I visit issue page "Community fix"'
do
mr
=
MergeRequest
.
find_by
(
title:
'Community fix'
)
visit
project_merge_request_path
(
mr
.
target_project
,
mr
)
end
step
'I should see a note linking to "Enterprise fix" merge request'
do
visible_note
(
issuable:
MergeRequest
.
find_by
(
title:
'Enterprise fix'
),
from_project_name:
'Community'
,
user_name:
'Mary Jane'
)
end
step
'I should see a note linking to "Enterprise issue" issue'
do
visible_note
(
issuable:
Issue
.
find_by
(
title:
'Enterprise issue'
),
from_project_name:
'Community'
,
user_name:
'Mary Jane'
)
end
step
'I click link "Edit" for the merge request'
do
step
'I click link "Edit" for the merge request'
do
edit_issuable
edit_issuable
end
end
...
...
features/steps/shared/note.rb
View file @
5373a5b1
...
@@ -18,8 +18,4 @@ module SharedNote
...
@@ -18,8 +18,4 @@ module SharedNote
expect
(
find
(
'.js-md-preview'
)).
to
have_content
(
'Nothing to preview.'
)
expect
(
find
(
'.js-md-preview'
)).
to
have_content
(
'Nothing to preview.'
)
end
end
end
end
step
'I should see no notes at all'
do
expect
(
page
).
not_to
have_css
(
'.note'
)
end
end
end
features/steps/shared/project.rb
View file @
5373a5b1
...
@@ -42,10 +42,6 @@ module SharedProject
...
@@ -42,10 +42,6 @@ module SharedProject
# Visibility level
# Visibility level
# ----------------------------------------
# ----------------------------------------
step
'private project "Enterprise"'
do
create
(
:project
,
:private
,
:repository
,
name:
'Enterprise'
)
end
step
'I should see project "Enterprise"'
do
step
'I should see project "Enterprise"'
do
expect
(
page
).
to
have_content
"Enterprise"
expect
(
page
).
to
have_content
"Enterprise"
end
end
...
@@ -70,10 +66,6 @@ module SharedProject
...
@@ -70,10 +66,6 @@ module SharedProject
end
end
end
end
step
'public project "Community"'
do
create
(
:project
,
:public
,
:repository
,
name:
'Community'
)
end
step
'I should see project "Community"'
do
step
'I should see project "Community"'
do
expect
(
page
).
to
have_content
"Community"
expect
(
page
).
to
have_content
"Community"
end
end
...
@@ -89,13 +81,6 @@ module SharedProject
...
@@ -89,13 +81,6 @@ module SharedProject
)
)
end
end
step
'"Mary Jane" owns private project "Enterprise"'
do
user_owns_project
(
user_name:
'Mary Jane'
,
project_name:
'Enterprise'
)
end
step
'"John Doe" owns internal project "Internal"'
do
step
'"John Doe" owns internal project "Internal"'
do
user_owns_project
(
user_owns_project
(
user_name:
'John Doe'
,
user_name:
'John Doe'
,
...
@@ -104,14 +89,6 @@ module SharedProject
...
@@ -104,14 +89,6 @@ module SharedProject
)
)
end
end
step
'"John Doe" owns public project "Community"'
do
user_owns_project
(
user_name:
'John Doe'
,
project_name:
'Community'
,
visibility: :public
)
end
step
'public empty project "Empty Public Project"'
do
step
'public empty project "Empty Public Project"'
do
create
:project_empty_repo
,
:public
,
name:
"Empty Public Project"
create
:project_empty_repo
,
:public
,
name:
"Empty Public Project"
end
end
...
...
spec/features/issuables/markdown_references/internal_references_spec.rb
View file @
5373a5b1
...
@@ -10,6 +10,7 @@ describe "Internal references", :js do
...
@@ -10,6 +10,7 @@ describe "Internal references", :js do
let
(
:public_project_user
)
{
public_project
.
owner
}
let
(
:public_project_user
)
{
public_project
.
owner
}
let
(
:public_project
)
{
create
(
:project
,
:public
,
:repository
)
}
let
(
:public_project
)
{
create
(
:project
,
:public
,
:repository
)
}
let
(
:public_project_issue
)
{
create
(
:issue
,
project:
public_project
)
}
let
(
:public_project_issue
)
{
create
(
:issue
,
project:
public_project
)
}
let
(
:public_project_merge_request
)
{
create
(
:merge_request
,
source_project:
public_project
)
}
context
"when referencing to open issue"
do
context
"when referencing to open issue"
do
context
"from private project"
do
context
"from private project"
do
...
@@ -77,4 +78,63 @@ describe "Internal references", :js do
...
@@ -77,4 +78,63 @@ describe "Internal references", :js do
end
end
end
end
end
end
context
"when referencing to open merge request"
do
context
"from private project"
do
context
"from issue"
do
before
do
sign_in
(
private_project_user
)
visit
(
project_issue_path
(
private_project
,
private_project_issue
))
add_note
(
"#
#{
public_project_merge_request
.
to_reference
(
private_project
)
}
"
)
end
context
"when user doesn't have access to private project"
do
before
do
sign_in
(
public_project_user
)
visit
(
project_merge_request_path
(
public_project
,
public_project_merge_request
))
end
it
{
expect
(
page
).
not_to
have_css
(
".note"
)
}
end
end
context
"from merge request"
do
before
do
sign_in
(
private_project_user
)
visit
(
project_merge_request_path
(
private_project
,
private_project_merge_request
))
add_note
(
"#
#{
public_project_merge_request
.
to_reference
(
private_project
)
}
"
)
end
context
"when user doesn't have access to private project"
do
before
do
sign_in
(
public_project_user
)
visit
(
project_merge_request_path
(
public_project
,
public_project_merge_request
))
end
it
"doesn't show any references"
do
page
.
within
(
".merge-request-details"
)
do
expect
(
page
).
not_to
have_content
(
"#merge-requests .merge-requests-title"
)
end
end
end
context
"when user has access to private project"
do
before
do
visit
(
project_merge_request_path
(
public_project
,
public_project_merge_request
))
end
it
"shows references"
do
expect
(
page
).
to
have_content
(
"mentioned in merge request
#{
private_project_merge_request
.
to_reference
(
public_project
)
}
"
)
.
and
have_content
(
private_project_user
.
name
)
end
end
end
end
end
end
end
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment