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
6865bc16
Commit
6865bc16
authored
Apr 21, 2016
by
James Lopez
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refactored specs, adding more scenarios
parent
07f8ffbd
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
34 additions
and
22 deletions
+34
-22
filter_by_labels_spec.rb
spec/features/issues/filter_by_labels_spec.rb
+15
-18
issuable_spec.rb
spec/models/concerns/issuable_spec.rb
+19
-4
No files found.
spec/features/issues/filter_by_labels_spec.rb
View file @
6865bc16
...
...
@@ -4,23 +4,25 @@ feature 'Issue filtering by Labels', feature: true do
let
(
:project
)
{
create
(
:project
,
:public
)
}
let!
(
:user
)
{
create
(
:user
)}
let!
(
:label
)
{
create
(
:label
,
project:
project
)
}
let
(
:bug
)
{
create
(
:label
,
project:
project
,
title:
'bug'
)
}
let
(
:feature
)
{
create
(
:label
,
project:
project
,
title:
'feature'
)
}
let
(
:enhancement
)
{
create
(
:label
,
project:
project
,
title:
'enhancement'
)
}
before
do
[
'bug'
,
'feature'
,
'enhancement'
].
each
do
|
title
|
create
(
:label
,
project:
project
,
title:
title
)
end
bug
=
create
(
:label
,
project:
project
,
title:
'bug'
)
feature
=
create
(
:label
,
project:
project
,
title:
'feature'
)
enhancement
=
create
(
:label
,
project:
project
,
title:
'enhancement'
)
issue1
=
create
(
:issue
,
title:
"Bugfix1"
,
project:
project
)
issue1
.
labels
<<
project
.
labels
.
find_by
(
title:
'bug'
)
issue1
.
labels
<<
bug
issue2
=
create
(
:issue
,
title:
"Bugfix2"
,
project:
project
)
issue2
.
labels
<<
project
.
labels
.
find_by
(
title:
'bug'
)
issue2
.
labels
<<
project
.
labels
.
find_by
(
title:
'enhancement'
)
issue2
.
labels
<<
bug
issue2
.
labels
<<
enhancement
issue3
=
create
(
:issue
,
title:
"Feature1"
,
project:
project
)
issue3
.
labels
<<
project
.
labels
.
find_by
(
title:
'feature'
)
issue3
.
labels
<<
feature
project
.
team
<<
[
user
,
:master
]
login_as
(
user
)
...
...
@@ -122,13 +124,9 @@ feature 'Issue filtering by Labels', feature: true do
sleep
2
end
it
'should show issue "Bugfix2" or "Feature1" in issues list'
do
expect
(
page
).
to
have_content
"Bugfix2"
expect
(
page
).
to
have_content
"Feature1"
end
it
'should not show "Bugfix1" in issues list'
do
it
'should not show "Bugfix1" or "Feature1" in issues list'
do
expect
(
page
).
not_to
have_content
"Bugfix1"
expect
(
page
).
not_to
have_content
"Feature1"
end
it
'should show label "enhancement" and "feature" in filtered-labels'
do
...
...
@@ -141,7 +139,7 @@ feature 'Issue filtering by Labels', feature: true do
end
end
context
'filter by label enhancement
or
bug in issues list'
,
js:
true
do
context
'filter by label enhancement
and
bug in issues list'
,
js:
true
do
before
do
page
.
find
(
'.js-label-select'
).
click
sleep
0.5
...
...
@@ -151,9 +149,8 @@ feature 'Issue filtering by Labels', feature: true do
sleep
2
end
it
'should show issue "Bugfix2"
or "Bugfix1"
in issues list'
do
it
'should show issue "Bugfix2" in issues list'
do
expect
(
page
).
to
have_content
"Bugfix2"
expect
(
page
).
to
have_content
"Bugfix1"
end
it
'should not show "Feature1"'
do
...
...
spec/models/concerns/issuable_spec.rb
View file @
6865bc16
...
...
@@ -217,16 +217,26 @@ describe Issue, "Issuable" do
let
(
:example_label
)
{
'test1'
}
let
(
:example_labels
)
{
[
'test1'
,
'test2'
]
}
it
'finds issue with 1 label'
do
before
(
:each
)
do
setup_other_issue
end
it
'finds the correct issue with 1 label'
do
setup_labels
([
example_label
])
expect
(
Issue
.
with_label
(
example_label
).
size
).
to
eq
(
1
)
expect
(
Issue
.
with_label
(
example_label
)).
to
eq
([
issue
])
end
it
'finds the correct issue with 2 labels'
do
setup_labels
(
example_labels
)
expect
(
Issue
.
with_label
(
example_labels
)).
to
eq
([
issue
])
end
it
'finds
issue with
2 labels'
do
it
'finds
the correct issue with 1 of
2 labels'
do
setup_labels
(
example_labels
)
expect
(
Issue
.
with_label
(
example_label
s
).
to_a
.
size
).
to
eq
(
1
)
expect
(
Issue
.
with_label
(
example_label
)).
to
eq
([
issue
]
)
end
def
setup_labels
(
label_names
)
...
...
@@ -235,5 +245,10 @@ describe Issue, "Issuable" do
end
issue
.
labels
<<
labels
end
def
setup_other_issue
issue2
=
create
(
:issue
)
issue2
.
labels
<<
create
(
:label
,
project:
issue2
.
project
,
title:
'other_label'
)
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