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
Jérome Perrin
gitlab-ce
Commits
569c7bec
Commit
569c7bec
authored
Aug 30, 2017
by
blackst0ne
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Replace 'project/star.feature' spinach test with an rspec analog
parent
2be34630
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
43 additions
and
76 deletions
+43
-76
changelogs/unreleased/replace_spinach_star-feature.yml
changelogs/unreleased/replace_spinach_star-feature.yml
+5
-0
features/project/star.feature
features/project/star.feature
+0
-39
features/steps/project/star.rb
features/steps/project/star.rb
+0
-37
spec/features/projects/user_interacts_with_stars_spec.rb
spec/features/projects/user_interacts_with_stars_spec.rb
+38
-0
No files found.
changelogs/unreleased/replace_spinach_star-feature.yml
0 → 100644
View file @
569c7bec
---
title
:
Replace 'project/star.feature' spinach test with an rspec analog
merge_request
:
13855
author
:
Vitaliy @blackst0ne Klachkov
type
:
other
features/project/star.feature
deleted
100644 → 0
View file @
2be34630
@project-stars
Feature
:
Project Star
Scenario
:
New projects have 0 stars
Given
public project
"Community"
When
I visit project
"Community"
page
Then
The project has no stars
Scenario
:
Empty projects show star count
Given
public empty project
"Empty Public Project"
When
I visit empty project page
Then
The project has no stars
Scenario
:
Signed off users can't star projects
Given
public project
"Community"
And
I visit project
"Community"
page
When
I click on the star toggle button
Then
I redirected to sign in page
@javascript
Scenario
:
Signed in users can toggle star
Given
I sign in as
"John Doe"
And
public project
"Community"
And
I visit project
"Community"
page
When
I click on the star toggle button
Then
The project has 1 star
When
I click on the star toggle button
Then
The project has 0 stars
@javascript
Scenario
:
Star count sums stars
Given
I sign in as
"John Doe"
And
public project
"Community"
And
I visit project
"Community"
page
And
I click on the star toggle button
And
I logout
And
I sign in as
"Mary Jane"
And
I visit project
"Community"
page
When
I click on the star toggle button
Then
The project has 2 stars
features/steps/project/star.rb
deleted
100644 → 0
View file @
2be34630
class
Spinach::Features::ProjectStar
<
Spinach
::
FeatureSteps
include
SharedAuthentication
include
SharedProject
include
SharedPaths
include
SharedUser
step
"The project has no stars"
do
expect
(
page
).
not_to
have_content
'.toggle-star'
end
step
"The project has 0 stars"
do
has_n_stars
(
0
)
end
step
"The project has 1 star"
do
has_n_stars
(
1
)
end
step
"The project has 2 stars"
do
has_n_stars
(
2
)
end
# Requires @javascript
step
"I click on the star toggle button"
do
find
(
".star-btn"
,
visible:
true
).
click
end
step
'I redirected to sign in page'
do
expect
(
current_path
).
to
eq
new_user_session_path
end
protected
def
has_n_stars
(
n
)
expect
(
page
).
to
have_css
(
".star-count"
,
text:
n
,
visible:
true
)
end
end
spec/features/projects/user_interacts_with_stars_spec.rb
0 → 100644
View file @
569c7bec
require
'spec_helper'
describe
'User interacts with project stars'
do
let
(
:project
)
{
create
(
:project
,
:public
,
:repository
)
}
context
'when user is signed in'
,
js:
true
do
let
(
:user
)
{
create
(
:user
)
}
before
do
sign_in
(
user
)
visit
(
project_path
(
project
))
end
it
'toggles the star'
do
find
(
'.star-btn'
).
click
expect
(
page
).
to
have_css
(
'.star-count'
,
text:
1
)
find
(
'.star-btn'
).
click
expect
(
page
).
to
have_css
(
'.star-count'
,
text:
0
)
end
end
context
'when user is not signed in'
do
before
do
visit
(
project_path
(
project
))
end
it
'does not allow to star a project'
do
expect
(
page
).
not_to
have_content
(
'.toggle-star'
)
find
(
'.star-btn'
).
click
expect
(
current_path
).
to
eq
(
new_user_session_path
)
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