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
8f08fbfd
Commit
8f08fbfd
authored
Mar 25, 2013
by
Andrew8xx8
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Tests for personal snippets added
parent
4be12be6
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
209 additions
and
0 deletions
+209
-0
features/snippets/discover_snippets.feature
features/snippets/discover_snippets.feature
+10
-0
features/snippets/snippets.feature
features/snippets/snippets.feature
+28
-0
features/snippets/user_snippets.feature
features/snippets/user_snippets.feature
+22
-0
features/steps/shared/paths.rb
features/steps/shared/paths.rb
+8
-0
features/steps/shared/snippet.rb
features/steps/shared/snippet.rb
+19
-0
features/steps/snippets/discover_snippets.rb
features/steps/snippets/discover_snippets.rb
+17
-0
features/steps/snippets/snippets.rb
features/steps/snippets/snippets.rb
+64
-0
features/steps/snippets/user_snippets.rb
features/steps/snippets/user_snippets.rb
+41
-0
No files found.
features/snippets/discover_snippets.feature
0 → 100644
View file @
8f08fbfd
Feature
:
Discover Snippets
Background
:
Given
I sign in as a user
And
I have public
"Personal snippet one"
snippet
And
I have private
"Personal snippet private"
snippet
Scenario
:
I
should see snippets
Given
I visit snippets page
Then
I should see
"Personal snippet one"
in snippets
And
I should not see
"Personal snippet private"
in snippets
features/snippets/snippets.feature
0 → 100644
View file @
8f08fbfd
Feature
:
Snippets
Background
:
Given
I sign in as a user
And
I have public
"Personal snippet one"
snippet
And
I have private
"Personal snippet private"
snippet
Scenario
:
I
create new snippet
Given
I visit new snippet page
And
I submit new snippet
"Personal snippet three"
Then
I should see snippet
"Personal snippet three"
Scenario
:
I
update
"Personal snippet one"
Given
I visit snippet page
"Personal snippet one"
And
I click link
"Edit"
And
I submit new title
"Personal snippet new title"
Then
I should see
"Personal snippet new title"
Scenario
:
Set "Personal snippet one" public
Given
I visit snippet page
"Personal snippet one"
And
I click link
"Edit"
And
I uncheck
"Private"
checkbox
Then
I should see
"Personal snippet one"
public
Scenario
:
I
destroy
"Personal snippet one"
Given
I visit snippet page
"Personal snippet one"
And
I click link
"Edit"
And
I click link
"Destroy"
Then
I should not see
"Personal snippet one"
in snippets
features/snippets/user_snippets.feature
0 → 100644
View file @
8f08fbfd
Feature
:
User Snippets
Background
:
Given
I sign in as a user
And
I have public
"Personal snippet one"
snippet
And
I have private
"Personal snippet private"
snippet
Scenario
:
I
should see all my snippets
Given
I visit my snippets page
Then
I should see
"Personal snippet one"
in snippets
And
I should see
"Personal snippet private"
in snippets
Scenario
:
I
can see only my private snippets
Given
I visit my snippets page
And
I click
"Private"
filter
Then
I should not see
"Personal snippet one"
in snippets
And
I should see
"Personal snippet private"
in snippets
Scenario
:
I
can see only my public snippets
Given
I visit my snippets page
And
I click
"Public"
filter
Then
I should see
"Personal snippet one"
in snippets
And
I should not see
"Personal snippet private"
in snippets
features/steps/shared/paths.rb
View file @
8f08fbfd
...
@@ -267,6 +267,14 @@ module SharedPaths
...
@@ -267,6 +267,14 @@ module SharedPaths
visit
project_snippets_path
(
project
)
visit
project_snippets_path
(
project
)
end
end
Given
'I visit snippets page'
do
visit
snippets_path
end
Given
'I visit new snippet page'
do
visit
new_snippet_path
end
def
root_ref
def
root_ref
@project
.
repository
.
root_ref
@project
.
repository
.
root_ref
end
end
...
...
features/steps/shared/snippet.rb
0 → 100644
View file @
8f08fbfd
module
SharedProject
And
'I have public "Personal snippet one" snippet'
do
create
(
:personal_snippet
,
title:
"Personal snippet one"
,
content:
"Test content"
,
file_name:
"snippet.rb"
,
private:
false
,
author:
current_user
)
end
And
'I have private "Personal snippet private" snippet'
do
create
(
:personal_snippet
,
title:
"Personal snippet private"
,
content:
"Provate content"
,
file_name:
"private_snippet.rb"
,
private:
true
,
author:
current_user
)
end
end
features/steps/snippets/discover_snippets.rb
0 → 100644
View file @
8f08fbfd
class
DiscoverSnippets
<
Spinach
::
FeatureSteps
include
SharedAuthentication
include
SharedPaths
include
SharedProject
Then
'I should see "Personal snippet one" in snippets'
do
page
.
should
have_content
"Personal snippet one"
end
And
'I should not see "Personal snippet private" in snippets'
do
page
.
should_not
have_content
"Personal snippet private"
end
def
snippet
@snippet
||=
PersonalSnippet
.
find_by_title!
(
"Personal snippet one"
)
end
end
features/steps/snippets/snippets.rb
0 → 100644
View file @
8f08fbfd
class
Snippets
<
Spinach
::
FeatureSteps
include
SharedAuthentication
include
SharedPaths
include
SharedProject
Given
'I click link "Personal snippet one"'
do
click_link
"Personal snippet one"
end
And
'I should not see "Personal snippet one" in snippets'
do
page
.
should_not
have_content
"Personal snippet one"
end
And
'I click link "Edit"'
do
within
".page_title"
do
click_link
"Edit"
end
end
And
'I click link "Destroy"'
do
click_link
"Destroy"
end
And
'I submit new snippet "Personal snippet three"'
do
fill_in
"personal_snippet_title"
,
:with
=>
"Personal snippet three"
select
"forever"
,
:from
=>
"personal_snippet_expires_at"
fill_in
"personal_snippet_file_name"
,
:with
=>
"my_snippet.rb"
within
(
'.file-editor'
)
do
find
(
:xpath
,
"//input[@id='personal_snippet_content']"
).
set
'Content of snippet three'
end
click_button
"Save"
end
Then
'I should see snippet "Personal snippet three"'
do
page
.
should
have_content
"Personal snippet three"
page
.
should
have_content
"Content of snippet three"
end
And
'I submit new title "Personal snippet new title"'
do
fill_in
"personal_snippet_title"
,
:with
=>
"Personal snippet new title"
click_button
"Save"
end
Then
'I should see "Personal snippet new title"'
do
page
.
should
have_content
"Personal snippet new title"
end
And
'I uncheck "Private" checkbox'
do
find
(
:xpath
,
"//input[@id='personal_snippet_private']"
).
set
true
click_button
"Save"
end
Then
'I should see "Personal snippet one" public'
do
page
.
should
have_selector
(
:xpath
,
"//i[@class='public-snippet']"
)
end
And
'I visit snippet page "Personal snippet one"'
do
visit
snippet_path
(
snippet
)
end
def
snippet
@snippet
||=
PersonalSnippet
.
find_by_title!
(
"Personal snippet one"
)
end
end
features/steps/snippets/user_snippets.rb
0 → 100644
View file @
8f08fbfd
class
UserSnippets
<
Spinach
::
FeatureSteps
include
SharedAuthentication
include
SharedPaths
include
SharedProject
Given
'I visit my snippets page'
do
visit
user_snippets_path
(
current_user
)
end
Then
'I should see "Personal snippet one" in snippets'
do
page
.
should
have_content
"Personal snippet one"
end
And
'I should see "Personal snippet private" in snippets'
do
page
.
should
have_content
"Personal snippet private"
end
Then
'I should not see "Personal snippet one" in snippets'
do
page
.
should_not
have_content
"Personal snippet one"
end
And
'I should not see "Personal snippet private" in snippets'
do
page
.
should_not
have_content
"Personal snippet private"
end
Given
'I click "Public" filter'
do
within
(
'.nav-stacked'
)
do
click_link
"Public"
end
end
Given
'I click "Private" filter'
do
within
(
'.nav-stacked'
)
do
click_link
"Private"
end
end
def
snippet
@snippet
||=
PersonalSnippet
.
find_by_title!
(
"Personal snippet one"
)
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