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
5d3165d4
Commit
5d3165d4
authored
Sep 18, 2017
by
Vitaliy @blackst0ne Klachkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Replace the 'project/snippets.feature' spinach test with an rspec analog
parent
2defc7b9
Changes
7
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
95 additions
and
135 deletions
+95
-135
changelogs/unreleased/replace_project_snippets-feature.yml
changelogs/unreleased/replace_project_snippets-feature.yml
+5
-0
features/project/snippets.feature
features/project/snippets.feature
+0
-35
features/steps/project/snippets.rb
features/steps/project/snippets.rb
+0
-100
spec/features/projects/snippets/user_comments_on_snippet_spec.rb
...atures/projects/snippets/user_comments_on_snippet_spec.rb
+25
-0
spec/features/projects/snippets/user_deletes_snippet_spec.rb
spec/features/projects/snippets/user_deletes_snippet_spec.rb
+20
-0
spec/features/projects/snippets/user_updates_snippet_spec.rb
spec/features/projects/snippets/user_updates_snippet_spec.rb
+25
-0
spec/features/projects/snippets/user_views_snippets_spec.rb
spec/features/projects/snippets/user_views_snippets_spec.rb
+20
-0
No files found.
changelogs/unreleased/replace_project_snippets-feature.yml
0 → 100644
View file @
5d3165d4
---
title
:
Replace the 'project/snippets.feature' spinach test with an rspec analog
merge_request
:
14326
author
:
Vitaliy @blackst0ne Klachkov
type
:
other
features/project/snippets.feature
deleted
100644 → 0
View file @
2defc7b9
Feature
:
Project Snippets
Background
:
Given
I sign in as a user
And
I own project
"Shop"
And
project
"Shop"
have
"Snippet one"
snippet
And
project
"Shop"
have no
"Snippet two"
snippet
And
I visit project
"Shop"
snippets page
Scenario
:
I
should see snippets
Given
I visit project
"Shop"
snippets page
Then
I should see
"Snippet one"
in snippets
And
I should not see
"Snippet two"
in snippets
@javascript
Scenario
:
I
create new project snippet
Given
I click link
"New snippet"
And
I submit new snippet
"Snippet three"
Then
I should see snippet
"Snippet three"
@javascript
Scenario
:
I
comment on a snippet
"Snippet one"
Given
I visit snippet page
"Snippet one"
And
I leave a comment like
"Good snippet!"
Then
I should see comment
"Good snippet!"
Scenario
:
I
update
"Snippet one"
Given
I visit snippet page
"Snippet one"
And
I click link
"Edit"
And
I submit new title
"Snippet new title"
Then
I should see
"Snippet new title"
Scenario
:
I
destroy
"Snippet one"
Given
I visit snippet page
"Snippet one"
And
I click link
"Delete"
Then
I should not see
"Snippet one"
in snippets
features/steps/project/snippets.rb
deleted
100644 → 0
View file @
2defc7b9
class
Spinach::Features::ProjectSnippets
<
Spinach
::
FeatureSteps
include
SharedAuthentication
include
SharedProject
include
SharedNote
include
SharedPaths
include
WaitForRequests
step
'project "Shop" have "Snippet one" snippet'
do
create
(
:project_snippet
,
title:
"Snippet one"
,
content:
"Test content"
,
file_name:
"snippet.rb"
,
project:
project
,
author:
project
.
users
.
first
)
end
step
'project "Shop" have no "Snippet two" snippet'
do
create
(
:snippet
,
title:
"Snippet two"
,
content:
"Test content"
,
file_name:
"snippet.rb"
,
author:
project
.
users
.
first
)
end
step
'I click link "New snippet"'
do
page
.
within
'.nav-controls'
do
first
(
:link
,
"New snippet"
).
click
end
end
step
'I click link "Snippet one"'
do
click_link
"Snippet one"
end
step
'I should see "Snippet one" in snippets'
do
expect
(
page
).
to
have_content
"Snippet one"
end
step
'I should not see "Snippet two" in snippets'
do
expect
(
page
).
not_to
have_content
"Snippet two"
end
step
'I should not see "Snippet one" in snippets'
do
expect
(
page
).
not_to
have_content
"Snippet one"
end
step
'I click link "Edit"'
do
page
.
within
".detail-page-header"
do
first
(
:link
,
"Edit"
).
click
end
end
step
'I click link "Delete"'
do
first
(
:link
,
"Delete"
).
click
end
step
'I submit new snippet "Snippet three"'
do
fill_in
"project_snippet_title"
,
with:
"Snippet three"
fill_in
"project_snippet_file_name"
,
with:
"my_snippet.rb"
page
.
within
(
'.file-editor'
)
do
find
(
'.ace_editor'
).
native
.
send_keys
'Content of snippet three'
end
click_button
"Create snippet"
wait_for_requests
end
step
'I should see snippet "Snippet three"'
do
expect
(
page
).
to
have_content
"Snippet three"
expect
(
page
).
to
have_content
"Content of snippet three"
end
step
'I submit new title "Snippet new title"'
do
fill_in
"project_snippet_title"
,
with:
"Snippet new title"
click_button
"Save"
end
step
'I should see "Snippet new title"'
do
expect
(
page
).
to
have_content
"Snippet new title"
end
step
'I leave a comment like "Good snippet!"'
do
page
.
within
(
'.js-main-target-form'
)
do
fill_in
"note_note"
,
with:
"Good snippet!"
click_button
"Comment"
end
wait_for_requests
end
step
'I should see comment "Good snippet!"'
do
expect
(
page
).
to
have_content
"Good snippet!"
end
step
'I visit snippet page "Snippet one"'
do
visit
project_snippet_path
(
project
,
project_snippet
)
end
def
project_snippet
@project_snippet
||=
ProjectSnippet
.
find_by!
(
title:
"Snippet one"
)
end
end
spec/features/projects/snippets/user_comments_on_snippet_spec.rb
0 → 100644
View file @
5d3165d4
require
'spec_helper'
describe
'User comments on a snippet'
,
:js
do
let
(
:project
)
{
create
(
:project
)
}
let!
(
:snippet
)
{
create
(
:project_snippet
,
project:
project
,
author:
user
)
}
let
(
:user
)
{
create
(
:user
)
}
before
do
project
.
add_master
(
user
)
sign_in
(
user
)
visit
(
project_snippet_path
(
project
,
snippet
))
end
it
'leaves a comment on a snippet'
do
page
.
within
(
'.js-main-target-form'
)
do
fill_in
(
'note_note'
,
with:
'Good snippet!'
)
click_button
(
'Comment'
)
end
wait_for_requests
expect
(
page
).
to
have_content
(
'Good snippet!'
)
end
end
spec/features/projects/snippets/user_deletes_snippet_spec.rb
0 → 100644
View file @
5d3165d4
require
'spec_helper'
describe
'User deletes a snippet'
do
let
(
:project
)
{
create
(
:project
)
}
let!
(
:snippet
)
{
create
(
:project_snippet
,
project:
project
,
author:
user
)
}
let
(
:user
)
{
create
(
:user
)
}
before
do
project
.
add_master
(
user
)
sign_in
(
user
)
visit
(
project_snippet_path
(
project
,
snippet
))
end
it
'deletes a snippet'
do
first
(
:link
,
'Delete'
).
click
expect
(
page
).
not_to
have_content
(
snippet
.
title
)
end
end
spec/features/projects/snippets/user_updates_snippet_spec.rb
0 → 100644
View file @
5d3165d4
require
'spec_helper'
describe
'User updates a snippet'
do
let
(
:project
)
{
create
(
:project
)
}
let!
(
:snippet
)
{
create
(
:project_snippet
,
project:
project
,
author:
user
)
}
let
(
:user
)
{
create
(
:user
)
}
before
do
project
.
add_master
(
user
)
sign_in
(
user
)
visit
(
project_snippet_path
(
project
,
snippet
))
end
it
'updates a snippet'
do
page
.
within
(
'.detail-page-header'
)
do
first
(
:link
,
'Edit'
).
click
end
fill_in
(
'project_snippet_title'
,
with:
'Snippet new title'
)
click_button
(
'Save'
)
expect
(
page
).
to
have_content
(
'Snippet new title'
)
end
end
spec/features/projects/snippets/user_views_snippets_spec.rb
0 → 100644
View file @
5d3165d4
require
'spec_helper'
describe
'User views snippets'
do
let
(
:project
)
{
create
(
:project
)
}
let!
(
:project_snippet
)
{
create
(
:project_snippet
,
project:
project
,
author:
user
)
}
let!
(
:snippet
)
{
create
(
:snippet
,
author:
user
)
}
let
(
:user
)
{
create
(
:user
)
}
before
do
project
.
add_master
(
user
)
sign_in
(
user
)
visit
(
project_snippets_path
(
project
))
end
it
'shows snippets'
do
expect
(
page
).
to
have_content
(
project_snippet
.
title
)
expect
(
page
).
not_to
have_content
(
snippet
.
title
)
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