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
Léo-Paul Géneau
gitlab-ce
Commits
90cccf0f
Commit
90cccf0f
authored
Apr 11, 2018
by
blackst0ne
Committed by
Rémy Coutable
Apr 11, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Replace the `project/issues/milestones.feature` spinach test with an rspec analog
parent
5566bc86
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
125 additions
and
139 deletions
+125
-139
changelogs/unreleased/blackst0ne-replace-spinach-project-issues-milestones-feature.yml
...0ne-replace-spinach-project-issues-milestones-feature.yml
+5
-0
features/project/issues/milestones.feature
features/project/issues/milestones.feature
+0
-43
features/steps/project/issues/milestones.rb
features/steps/project/issues/milestones.rb
+0
-58
features/steps/shared/markdown.rb
features/steps/shared/markdown.rb
+0
-4
features/steps/shared/paths.rb
features/steps/shared/paths.rb
+0
-8
spec/features/milestones/show_spec.rb
spec/features/milestones/show_spec.rb
+0
-26
spec/features/milestones/user_creates_milestone_spec.rb
spec/features/milestones/user_creates_milestone_spec.rb
+29
-0
spec/features/milestones/user_deletes_milestone_spec.rb
spec/features/milestones/user_deletes_milestone_spec.rb
+25
-0
spec/features/milestones/user_views_milestone_spec.rb
spec/features/milestones/user_views_milestone_spec.rb
+31
-0
spec/features/milestones/user_views_milestones_spec.rb
spec/features/milestones/user_views_milestones_spec.rb
+35
-0
No files found.
changelogs/unreleased/blackst0ne-replace-spinach-project-issues-milestones-feature.yml
0 → 100644
View file @
90cccf0f
---
title
:
Replace the `project/issues/milestones.feature` spinach test with an rspec analog
merge_request
:
18300
author
:
"
@blackst0ne"
type
:
other
features/project/issues/milestones.feature
deleted
100644 → 0
View file @
5566bc86
@project_issues
Feature
:
Project Issues Milestones
Background
:
Given
I sign in as a user
And
I own project
"Shop"
And
project
"Shop"
has milestone
"v2.2"
Given
I visit project
"Shop"
milestones page
Scenario
:
I
should see active milestones
Then
I should see milestone
"v2.2"
Scenario
:
I
should see milestone
Given
I click link
"v2.2"
Then
I should see milestone
"v2.2"
@javascript
Scenario
:
I
create and delete new milestone
Given
I click link
"New Milestone"
And
I submit new milestone
"v2.3"
Then
I should see milestone
"v2.3"
Given
I click button to remove milestone
And
I confirm in modal
When
I visit project
"Shop"
activity page
Then
I should see deleted milestone activity
@javascript
Scenario
:
I
delete new milestone
Given
I click button to remove milestone
And
I confirm in modal
And
I should see no milestones
@javascript
Scenario
:
Listing closed issues
Given
the milestone has open and closed issues
And
I click link
"v2.2"
Then
I should see 3 issues
# Markdown
Scenario
:
Headers inside the description should have ids generated for them.
Given
I click link
"v2.2"
# PLEASE USE the `have_header_with_correct_id_and_link(level, text, id, parent)` matcher on migrating this spec to rspec.
Then
Header
"Description header"
should have correct id and link
features/steps/project/issues/milestones.rb
View file @
90cccf0f
...
@@ -4,35 +4,6 @@ class Spinach::Features::ProjectIssuesMilestones < Spinach::FeatureSteps
...
@@ -4,35 +4,6 @@ class Spinach::Features::ProjectIssuesMilestones < Spinach::FeatureSteps
include
SharedPaths
include
SharedPaths
include
SharedMarkdown
include
SharedMarkdown
step
'I should see milestone "v2.2"'
do
milestone
=
@project
.
milestones
.
find_by
(
title:
"v2.2"
)
expect
(
page
).
to
have_content
(
milestone
.
title
[
0
..
10
])
expect
(
page
).
to
have_content
(
milestone
.
expires_at
)
expect
(
page
).
to
have_content
(
"Issues"
)
end
step
'I click link "v2.2"'
do
click_link
"v2.2"
end
step
'I click link "New Milestone"'
do
page
.
within
(
'.nav-controls'
)
do
click_link
"New milestone"
end
end
step
'I submit new milestone "v2.3"'
do
fill_in
"milestone_title"
,
with:
"v2.3"
click_button
"Create milestone"
end
step
'I should see milestone "v2.3"'
do
milestone
=
@project
.
milestones
.
find_by
(
title:
"v2.3"
)
expect
(
page
).
to
have_content
(
milestone
.
title
[
0
..
10
])
expect
(
page
).
to
have_content
(
milestone
.
expires_at
)
expect
(
page
).
to
have_content
(
"Issues"
)
end
step
'project "Shop" has milestone "v2.2"'
do
step
'project "Shop" has milestone "v2.2"'
do
project
=
Project
.
find_by
(
name:
"Shop"
)
project
=
Project
.
find_by
(
name:
"Shop"
)
milestone
=
create
(
:milestone
,
milestone
=
create
(
:milestone
,
...
@@ -43,36 +14,7 @@ class Spinach::Features::ProjectIssuesMilestones < Spinach::FeatureSteps
...
@@ -43,36 +14,7 @@ class Spinach::Features::ProjectIssuesMilestones < Spinach::FeatureSteps
3
.
times
{
create
(
:issue
,
project:
project
,
milestone:
milestone
)
}
3
.
times
{
create
(
:issue
,
project:
project
,
milestone:
milestone
)
}
end
end
step
'the milestone has open and closed issues'
do
project
=
Project
.
find_by
(
name:
"Shop"
)
milestone
=
project
.
milestones
.
find_by
(
title:
'v2.2'
)
# 3 Open issues created above; create one closed issue
create
(
:closed_issue
,
project:
project
,
milestone:
milestone
)
end
step
'I should see deleted milestone activity'
do
expect
(
page
).
to
have_content
(
'opened milestone in'
)
expect
(
page
).
to
have_content
(
'destroyed milestone in'
)
end
When
'I click link "All Issues"'
do
When
'I click link "All Issues"'
do
click_link
'All Issues'
click_link
'All Issues'
end
end
step
'I should see 3 issues'
do
expect
(
page
).
to
have_selector
(
'#tab-issues li.issuable-row'
,
count:
4
)
end
step
'I click button to remove milestone'
do
click_button
'Delete'
end
step
'I confirm in modal'
do
click_button
'Delete milestone'
end
step
'I should see no milestones'
do
expect
(
page
).
to
have_content
(
'No milestones to show'
)
end
end
end
features/steps/shared/markdown.rb
View file @
90cccf0f
...
@@ -10,10 +10,6 @@ module SharedMarkdown
...
@@ -10,10 +10,6 @@ module SharedMarkdown
expect
(
find
(
:xpath
,
"
#{
node
.
path
}
/.."
).
text
).
to
eq
text
expect
(
find
(
:xpath
,
"
#{
node
.
path
}
/.."
).
text
).
to
eq
text
end
end
step
'Header "Description header" should have correct id and link'
do
header_should_have_correct_id_and_link
(
1
,
'Description header'
,
'description-header'
)
end
step
'I should not see the Markdown preview'
do
step
'I should not see the Markdown preview'
do
expect
(
find
(
'.gfm-form .js-md-preview'
)).
not_to
be_visible
expect
(
find
(
'.gfm-form .js-md-preview'
)).
not_to
be_visible
end
end
...
...
features/steps/shared/paths.rb
View file @
90cccf0f
...
@@ -264,10 +264,6 @@ module SharedPaths
...
@@ -264,10 +264,6 @@ module SharedPaths
visit
project_path
(
project
)
visit
project_path
(
project
)
end
end
step
'I visit project "Shop" activity page'
do
visit
activity_project_path
(
project
)
end
step
'I visit project "Forked Shop" merge requests page'
do
step
'I visit project "Forked Shop" merge requests page'
do
visit
project_merge_requests_path
(
@forked_project
)
visit
project_merge_requests_path
(
@forked_project
)
end
end
...
@@ -373,10 +369,6 @@ module SharedPaths
...
@@ -373,10 +369,6 @@ module SharedPaths
visit
project_merge_requests_path
(
project
)
visit
project_merge_requests_path
(
project
)
end
end
step
'I visit project "Shop" milestones page'
do
visit
project_milestones_path
(
project
)
end
step
'I visit project "Shop" team page'
do
step
'I visit project "Shop" team page'
do
visit
project_project_members_path
(
project
)
visit
project_project_members_path
(
project
)
end
end
...
...
spec/features/milestones/show_spec.rb
deleted
100644 → 0
View file @
5566bc86
require
'rails_helper'
describe
'Milestone show'
do
let
(
:user
)
{
create
(
:user
)
}
let
(
:project
)
{
create
(
:project
)
}
let
(
:milestone
)
{
create
(
:milestone
,
project:
project
)
}
let
(
:labels
)
{
create_list
(
:label
,
2
,
project:
project
)
}
let
(
:issue_params
)
{
{
project:
project
,
assignees:
[
user
],
author:
user
,
milestone:
milestone
,
labels:
labels
}
}
before
do
project
.
add_user
(
user
,
:developer
)
sign_in
(
user
)
end
def
visit_milestone
visit
project_milestone_path
(
project
,
milestone
)
end
it
'avoids N+1 database queries'
do
create
(
:labeled_issue
,
issue_params
)
control
=
ActiveRecord
::
QueryRecorder
.
new
{
visit_milestone
}
create_list
(
:labeled_issue
,
10
,
issue_params
)
expect
{
visit_milestone
}.
not_to
exceed_query_limit
(
control
)
end
end
spec/features/milestones/user_creates_milestone_spec.rb
0 → 100644
View file @
90cccf0f
require
"rails_helper"
describe
"User creates milestone"
,
:js
do
set
(
:user
)
{
create
(
:user
)
}
set
(
:project
)
{
create
(
:project
)
}
before
do
project
.
add_developer
(
user
)
sign_in
(
user
)
visit
(
new_project_milestone_path
(
project
))
end
it
"creates milestone"
do
TITLE
=
"v2.3"
.
freeze
fill_in
(
"Title"
,
with:
TITLE
)
fill_in
(
"Description"
,
with:
"# Description header"
)
click_button
(
"Create milestone"
)
expect
(
page
).
to
have_content
(
TITLE
)
.
and
have_content
(
"Issues"
)
.
and
have_header_with_correct_id_and_link
(
1
,
"Description header"
,
"description-header"
)
visit
(
activity_project_path
(
project
))
expect
(
page
).
to
have_content
(
"
#{
user
.
name
}
opened milestone"
)
end
end
spec/features/milestones/user_deletes_milestone_spec.rb
0 → 100644
View file @
90cccf0f
require
"rails_helper"
describe
"User deletes milestone"
,
:js
do
set
(
:user
)
{
create
(
:user
)
}
set
(
:project
)
{
create
(
:project
)
}
set
(
:milestone
)
{
create
(
:milestone
,
project:
project
)
}
before
do
project
.
add_developer
(
user
)
sign_in
(
user
)
visit
(
project_milestones_path
(
project
))
end
it
"deletes milestone"
do
click_button
(
"Delete"
)
click_button
(
"Delete milestone"
)
expect
(
page
).
to
have_content
(
"No milestones to show"
)
visit
(
activity_project_path
(
project
))
expect
(
page
).
to
have_content
(
"
#{
user
.
name
}
destroyed milestone"
)
end
end
spec/features/milestones/user_views_milestone_spec.rb
0 → 100644
View file @
90cccf0f
require
"rails_helper"
describe
"User views milestone"
do
set
(
:user
)
{
create
(
:user
)
}
set
(
:project
)
{
create
(
:project
)
}
set
(
:milestone
)
{
create
(
:milestone
,
project:
project
)
}
set
(
:labels
)
{
create_list
(
:label
,
2
,
project:
project
)
}
before
do
project
.
add_developer
(
user
)
sign_in
(
user
)
end
it
"avoids N+1 database queries"
do
ISSUE_PARAMS
=
{
project:
project
,
assignees:
[
user
],
author:
user
,
milestone:
milestone
,
labels:
labels
}.
freeze
create
(
:labeled_issue
,
ISSUE_PARAMS
)
control
=
ActiveRecord
::
QueryRecorder
.
new
{
visit_milestone
}
create
(
:labeled_issue
,
ISSUE_PARAMS
)
expect
{
visit_milestone
}.
not_to
exceed_query_limit
(
control
)
end
private
def
visit_milestone
visit
(
project_milestone_path
(
project
,
milestone
))
end
end
spec/features/milestones/user_views_milestones_spec.rb
0 → 100644
View file @
90cccf0f
require
"rails_helper"
describe
"User views milestones"
do
set
(
:user
)
{
create
(
:user
)
}
set
(
:project
)
{
create
(
:project
)
}
set
(
:milestone
)
{
create
(
:milestone
,
project:
project
)
}
before
do
project
.
add_developer
(
user
)
sign_in
(
user
)
visit
(
project_milestones_path
(
project
))
end
it
"shows milestone"
do
expect
(
page
).
to
have_content
(
milestone
.
title
)
.
and
have_content
(
milestone
.
expires_at
)
.
and
have_content
(
"Issues"
)
end
context
"with issues"
do
set
(
:issue
)
{
create
(
:issue
,
project:
project
,
milestone:
milestone
)
}
set
(
:closed_issue
)
{
create
(
:closed_issue
,
project:
project
,
milestone:
milestone
)
}
it
"opens milestone"
do
click_link
(
milestone
.
title
)
expect
(
current_path
).
to
eq
(
project_milestone_path
(
project
,
milestone
))
expect
(
page
).
to
have_content
(
milestone
.
title
)
.
and
have_selector
(
"#tab-issues li.issuable-row"
,
count:
2
)
.
and
have_content
(
issue
.
title
)
.
and
have_content
(
closed_issue
.
title
)
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