BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
gitlab-ce
Commits
70f868b7
Unverified
Commit
70f868b7
authored
Jul 30, 2014
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix tests
Signed-off-by:
Dmitriy Zaporozhets
<
dmitriy.zaporozhets@gmail.com
>
parent
593df8e6
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
35 additions
and
70 deletions
+35
-70
labels.feature
features/project/issues/labels.feature
+1
-1
filter_labels.rb
features/steps/project/filter_labels.rb
+0
-7
labels.rb
features/steps/project/labels.rb
+2
-8
project.rb
features/steps/shared/project.rb
+7
-4
projects.rb
lib/api/projects.rb
+1
-1
labels_spec.rb
spec/requests/api/labels_spec.rb
+24
-0
projects_spec.rb
spec/requests/api/projects_spec.rb
+0
-49
No files found.
features/project/issues/labels.feature
View file @
70f868b7
...
@@ -2,7 +2,7 @@ Feature: Project Labels
...
@@ -2,7 +2,7 @@ Feature: Project Labels
Background
:
Background
:
Given
I sign in as a user
Given
I sign in as a user
And
I own project
"Shop"
And
I own project
"Shop"
And project "Shop" ha
ve issues tags
:
"bug",
"feature
"
And project "Shop" ha
s labels
:
"bug",
"feature",
"enhancement
"
Given
I visit project
"Shop"
labels page
Given
I visit project
"Shop"
labels page
Scenario
:
I
should see active milestones
Scenario
:
I
should see active milestones
...
...
features/steps/project/filter_labels.rb
View file @
70f868b7
...
@@ -3,13 +3,6 @@ class ProjectFilterLabels < Spinach::FeatureSteps
...
@@ -3,13 +3,6 @@ class ProjectFilterLabels < Spinach::FeatureSteps
include
SharedProject
include
SharedProject
include
SharedPaths
include
SharedPaths
step
'project "Shop" has labels: "bug", "feature", "enhancement"'
do
project
=
Project
.
find_by
(
name:
"Shop"
)
create
(
:label
,
project:
project
,
title:
'bug'
)
create
(
:label
,
project:
project
,
title:
'feature'
)
create
(
:label
,
project:
project
,
title:
'enhancement'
)
end
step
'I should see "bug" in labels filter'
do
step
'I should see "bug" in labels filter'
do
within
".labels-filter"
do
within
".labels-filter"
do
page
.
should
have_content
"bug"
page
.
should
have_content
"bug"
...
...
features/steps/project/labels.rb
View file @
70f868b7
...
@@ -4,20 +4,14 @@ class ProjectLabels < Spinach::FeatureSteps
...
@@ -4,20 +4,14 @@ class ProjectLabels < Spinach::FeatureSteps
include
SharedPaths
include
SharedPaths
Then
'I should see label "bug"'
do
Then
'I should see label "bug"'
do
within
".
labels-table
"
do
within
".
manage-labels-list
"
do
page
.
should
have_content
"bug"
page
.
should
have_content
"bug"
end
end
end
end
And
'I should see label "feature"'
do
And
'I should see label "feature"'
do
within
".
labels-table
"
do
within
".
manage-labels-list
"
do
page
.
should
have_content
"feature"
page
.
should
have_content
"feature"
end
end
end
end
And
'project "Shop" have issues tags: "bug", "feature"'
do
project
=
Project
.
find_by
(
name:
"Shop"
)
label1
=
create
(
:label
,
project:
project
,
title:
'bug'
)
label2
=
create
(
:label
,
project:
project
,
title:
'feature'
)
end
end
end
features/steps/shared/project.rb
View file @
70f868b7
...
@@ -123,10 +123,6 @@ module SharedProject
...
@@ -123,10 +123,6 @@ module SharedProject
project
.
team
<<
[
user
,
:master
]
project
.
team
<<
[
user
,
:master
]
end
end
# ----------------------------------------
# Empty projects
# ----------------------------------------
step
'public empty project "Empty Public Project"'
do
step
'public empty project "Empty Public Project"'
do
create
:empty_project
,
:public
,
name:
"Empty Public Project"
create
:empty_project
,
:public
,
name:
"Empty Public Project"
end
end
...
@@ -135,4 +131,11 @@ module SharedProject
...
@@ -135,4 +131,11 @@ module SharedProject
project
=
Project
.
find_by
(
name:
"Community"
)
project
=
Project
.
find_by
(
name:
"Community"
)
2
.
times
{
create
(
:note_on_issue
,
project:
project
)
}
2
.
times
{
create
(
:note_on_issue
,
project:
project
)
}
end
end
step
'project "Shop" has labels: "bug", "feature", "enhancement"'
do
project
=
Project
.
find_by
(
name:
"Shop"
)
create
(
:label
,
project:
project
,
title:
'bug'
)
create
(
:label
,
project:
project
,
title:
'feature'
)
create
(
:label
,
project:
project
,
title:
'enhancement'
)
end
end
end
lib/api/projects.rb
View file @
70f868b7
...
@@ -222,7 +222,7 @@ module API
...
@@ -222,7 +222,7 @@ module API
# Example Request:
# Example Request:
# GET /projects/:id/labels
# GET /projects/:id/labels
get
':id/labels'
do
get
':id/labels'
do
@labels
=
user_project
.
issues_
labels
@labels
=
user_project
.
labels
present
@labels
,
with:
Entities
::
Label
present
@labels
,
with:
Entities
::
Label
end
end
end
end
...
...
spec/requests/api/labels_spec.rb
0 → 100644
View file @
70f868b7
require
'spec_helper'
describe
API
::
API
,
api:
true
do
include
ApiHelpers
let
(
:user
)
{
create
(
:user
)
}
let
(
:project
)
{
create
(
:project
,
creator_id:
user
.
id
,
namespace:
user
.
namespace
)
}
let!
(
:label1
)
{
create
(
:label
,
title:
'label1'
,
project:
project
)
}
before
do
project
.
team
<<
[
user
,
:master
]
end
describe
'GET /projects/:id/labels'
do
it
'should return project labels'
do
get
api
(
"/projects/
#{
project
.
id
}
/labels"
,
user
)
response
.
status
.
should
==
200
json_response
.
should
be_an
Array
json_response
.
size
.
should
==
1
json_response
.
first
[
'name'
].
should
==
label1
.
name
end
end
end
spec/requests/api/projects_spec.rb
View file @
70f868b7
...
@@ -10,13 +10,6 @@ describe API::API, api: true do
...
@@ -10,13 +10,6 @@ describe API::API, api: true do
let
(
:snippet
)
{
create
(
:project_snippet
,
author:
user
,
project:
project
,
title:
'example'
)
}
let
(
:snippet
)
{
create
(
:project_snippet
,
author:
user
,
project:
project
,
title:
'example'
)
}
let
(
:users_project
)
{
create
(
:users_project
,
user:
user
,
project:
project
,
project_access:
UsersProject
::
MASTER
)
}
let
(
:users_project
)
{
create
(
:users_project
,
user:
user
,
project:
project
,
project_access:
UsersProject
::
MASTER
)
}
let
(
:users_project2
)
{
create
(
:users_project
,
user:
user3
,
project:
project
,
project_access:
UsersProject
::
DEVELOPER
)
}
let
(
:users_project2
)
{
create
(
:users_project
,
user:
user3
,
project:
project
,
project_access:
UsersProject
::
DEVELOPER
)
}
let
(
:issue_with_labels
)
{
create
(
:issue
,
author:
user
,
assignee:
user
,
project:
project
,
:label_list
=>
"label1, label2"
)
}
let
(
:merge_request_with_labels
)
do
create
(
:merge_request
,
:simple
,
author:
user
,
assignee:
user
,
source_project:
project
,
target_project:
project
,
title:
'Test'
,
label_list:
'label3, label4'
)
end
describe
"GET /projects"
do
describe
"GET /projects"
do
before
{
project
}
before
{
project
}
...
@@ -634,46 +627,4 @@ describe API::API, api: true do
...
@@ -634,46 +627,4 @@ describe API::API, api: true do
end
end
end
end
end
end
describe
'GET /projects/:id/labels'
do
context
'with an issue'
do
before
{
issue_with_labels
}
it
'should return project labels'
do
get
api
(
"/projects/
#{
project
.
id
}
/labels"
,
user
)
response
.
status
.
should
==
200
json_response
.
should
be_an
Array
json_response
.
first
[
'name'
].
should
==
issue_with_labels
.
labels
.
first
.
name
json_response
.
last
[
'name'
].
should
==
issue_with_labels
.
labels
.
last
.
name
end
end
context
'with a merge request'
do
before
{
merge_request_with_labels
}
it
'should return project labels'
do
get
api
(
"/projects/
#{
project
.
id
}
/labels"
,
user
)
response
.
status
.
should
==
200
json_response
.
should
be_an
Array
json_response
.
first
[
'name'
].
should
==
merge_request_with_labels
.
labels
.
first
.
name
json_response
.
last
[
'name'
].
should
==
merge_request_with_labels
.
labels
.
last
.
name
end
end
context
'with an issue and a merge request'
do
before
do
issue_with_labels
merge_request_with_labels
end
it
'should return project labels from both'
do
get
api
(
"/projects/
#{
project
.
id
}
/labels"
,
user
)
response
.
status
.
should
==
200
json_response
.
should
be_an
Array
all_labels
=
issue_with_labels
.
labels
.
map
(
&
:name
).
to_a
.
concat
(
merge_request_with_labels
.
labels
.
map
(
&
:name
).
to_a
)
json_response
.
map
{
|
e
|
e
[
'name'
]
}.
should
=~
all_labels
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