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
Tatuya Kamada
gitlab-ce
Commits
44c55307
Commit
44c55307
authored
Nov 27, 2013
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use 1.9 hash syntax for some tests
Signed-off-by:
Dmitriy Zaporozhets
<
dmitriy.zaporozhets@gmail.com
>
parent
526c2fdf
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
31 deletions
+23
-31
spec/contexts/issues/list_context_spec.rb
spec/contexts/issues/list_context_spec.rb
+9
-13
spec/features/issues_spec.rb
spec/features/issues_spec.rb
+14
-18
No files found.
spec/contexts/issues/list_context_spec.rb
View file @
44c55307
...
@@ -11,23 +11,22 @@ describe Issues::ListContext do
...
@@ -11,23 +11,22 @@ describe Issues::ListContext do
end
end
describe
'sorting'
do
describe
'sorting'
do
it
'sorts by newest'
do
it
'sorts by newest'
do
params
=
{
:sort
=>
'newest'
}
params
=
{
sort:
'newest'
}
issues
=
Issues
::
ListContext
.
new
(
project
,
user
,
params
).
execute
issues
=
Issues
::
ListContext
.
new
(
project
,
user
,
params
).
execute
issues
.
first
.
should
eq
foo
issues
.
first
.
should
eq
foo
end
end
it
'sorts by oldest'
do
it
'sorts by oldest'
do
params
=
{
:sort
=>
'oldest'
}
params
=
{
sort:
'oldest'
}
issues
=
Issues
::
ListContext
.
new
(
project
,
user
,
params
).
execute
issues
=
Issues
::
ListContext
.
new
(
project
,
user
,
params
).
execute
issues
.
first
.
should
eq
baz
issues
.
first
.
should
eq
baz
end
end
it
'sorts by recently updated'
do
it
'sorts by recently updated'
do
params
=
{
:sort
=>
'recently_updated'
}
params
=
{
sort:
'recently_updated'
}
baz
.
updated_at
=
Time
.
now
+
10
baz
.
updated_at
=
Time
.
now
+
10
baz
.
save
baz
.
save
...
@@ -36,7 +35,7 @@ describe Issues::ListContext do
...
@@ -36,7 +35,7 @@ describe Issues::ListContext do
end
end
it
'sorts by least recently updated'
do
it
'sorts by least recently updated'
do
params
=
{
:sort
=>
'last_updated'
}
params
=
{
sort:
'last_updated'
}
bar
.
updated_at
=
Time
.
now
-
10
bar
.
updated_at
=
Time
.
now
-
10
bar
.
save
bar
.
save
...
@@ -45,9 +44,8 @@ describe Issues::ListContext do
...
@@ -45,9 +44,8 @@ describe Issues::ListContext do
end
end
describe
'sorting by milestone'
do
describe
'sorting by milestone'
do
let
(
:newer_due_milestone
)
{
create
(
:milestone
,
due_date:
'2013-12-11'
)
}
let
(
:newer_due_milestone
)
{
create
(
:milestone
,
:due_date
=>
'2013-12-11'
)
}
let
(
:later_due_milestone
)
{
create
(
:milestone
,
due_date:
'2013-12-12'
)
}
let
(
:later_due_milestone
)
{
create
(
:milestone
,
:due_date
=>
'2013-12-12'
)
}
before
:each
do
before
:each
do
foo
.
milestone
=
newer_due_milestone
foo
.
milestone
=
newer_due_milestone
...
@@ -57,7 +55,7 @@ describe Issues::ListContext do
...
@@ -57,7 +55,7 @@ describe Issues::ListContext do
end
end
it
'sorts by most recently due milestone'
do
it
'sorts by most recently due milestone'
do
params
=
{
:sort
=>
'milestone_due_soon'
}
params
=
{
sort:
'milestone_due_soon'
}
issues
=
Issues
::
ListContext
.
new
(
project
,
user
,
params
).
execute
issues
=
Issues
::
ListContext
.
new
(
project
,
user
,
params
).
execute
issues
.
first
.
should
eq
foo
issues
.
first
.
should
eq
foo
...
@@ -65,13 +63,11 @@ describe Issues::ListContext do
...
@@ -65,13 +63,11 @@ describe Issues::ListContext do
end
end
it
'sorts by least recently due milestone'
do
it
'sorts by least recently due milestone'
do
params
=
{
:sort
=>
'milestone_due_later'
}
params
=
{
sort:
'milestone_due_later'
}
issues
=
Issues
::
ListContext
.
new
(
project
,
user
,
params
).
execute
issues
=
Issues
::
ListContext
.
new
(
project
,
user
,
params
).
execute
issues
.
first
.
should
eq
bar
issues
.
first
.
should
eq
bar
end
end
end
end
end
end
end
end
spec/features/issues_spec.rb
View file @
44c55307
...
@@ -101,21 +101,21 @@ describe "Issues" do
...
@@ -101,21 +101,21 @@ describe "Issues" do
titles
.
each_with_index
do
|
title
,
index
|
titles
.
each_with_index
do
|
title
,
index
|
let!
(
title
.
to_sym
)
{
create
(
:issue
,
title:
title
,
project:
project
,
created_at:
Time
.
now
-
(
index
*
60
))
}
let!
(
title
.
to_sym
)
{
create
(
:issue
,
title:
title
,
project:
project
,
created_at:
Time
.
now
-
(
index
*
60
))
}
end
end
let
(
:newer_due_milestone
)
{
create
(
:milestone
,
:due_date
=>
'2013-12-11'
)
}
let
(
:newer_due_milestone
)
{
create
(
:milestone
,
due_date:
'2013-12-11'
)
}
let
(
:later_due_milestone
)
{
create
(
:milestone
,
:due_date
=>
'2013-12-12'
)
}
let
(
:later_due_milestone
)
{
create
(
:milestone
,
due_date:
'2013-12-12'
)
}
it
'sorts by newest'
do
it
'sorts by newest'
do
visit
project_issues_path
(
project
,
sort:
'newest'
)
visit
project_issues_path
(
project
,
sort:
'newest'
)
page
.
should
have_selector
(
"ul.issues-list li:first-child"
,
:text
=>
'foo'
)
page
.
should
have_selector
(
"ul.issues-list li:first-child"
,
text:
'foo'
)
page
.
should
have_selector
(
"ul.issues-list li:last-child"
,
:text
=>
'baz'
)
page
.
should
have_selector
(
"ul.issues-list li:last-child"
,
text:
'baz'
)
end
end
it
'sorts by oldest'
do
it
'sorts by oldest'
do
visit
project_issues_path
(
project
,
sort:
'oldest'
)
visit
project_issues_path
(
project
,
sort:
'oldest'
)
page
.
should
have_selector
(
"ul.issues-list li:first-child"
,
:text
=>
'baz'
)
page
.
should
have_selector
(
"ul.issues-list li:first-child"
,
text:
'baz'
)
page
.
should
have_selector
(
"ul.issues-list li:last-child"
,
:text
=>
'foo'
)
page
.
should
have_selector
(
"ul.issues-list li:last-child"
,
text:
'foo'
)
end
end
it
'sorts by most recently updated'
do
it
'sorts by most recently updated'
do
...
@@ -123,7 +123,7 @@ describe "Issues" do
...
@@ -123,7 +123,7 @@ describe "Issues" do
baz
.
save
baz
.
save
visit
project_issues_path
(
project
,
sort:
'recently_updated'
)
visit
project_issues_path
(
project
,
sort:
'recently_updated'
)
page
.
should
have_selector
(
"ul.issues-list li:first-child"
,
:text
=>
'baz'
)
page
.
should
have_selector
(
"ul.issues-list li:first-child"
,
text:
'baz'
)
end
end
it
'sorts by least recently updated'
do
it
'sorts by least recently updated'
do
...
@@ -131,11 +131,10 @@ describe "Issues" do
...
@@ -131,11 +131,10 @@ describe "Issues" do
baz
.
save
baz
.
save
visit
project_issues_path
(
project
,
sort:
'last_updated'
)
visit
project_issues_path
(
project
,
sort:
'last_updated'
)
page
.
should
have_selector
(
"ul.issues-list li:first-child"
,
:text
=>
'baz'
)
page
.
should
have_selector
(
"ul.issues-list li:first-child"
,
text:
'baz'
)
end
end
describe
'sorting by milestone'
do
describe
'sorting by milestone'
do
before
:each
do
before
:each
do
foo
.
milestone
=
newer_due_milestone
foo
.
milestone
=
newer_due_milestone
foo
.
save
foo
.
save
...
@@ -146,18 +145,17 @@ describe "Issues" do
...
@@ -146,18 +145,17 @@ describe "Issues" do
it
'sorts by recently due milestone'
do
it
'sorts by recently due milestone'
do
visit
project_issues_path
(
project
,
sort:
'milestone_due_soon'
)
visit
project_issues_path
(
project
,
sort:
'milestone_due_soon'
)
page
.
should
have_selector
(
"ul.issues-list li:first-child"
,
:text
=>
'foo'
)
page
.
should
have_selector
(
"ul.issues-list li:first-child"
,
text:
'foo'
)
end
end
it
'sorts by least recently due milestone'
do
it
'sorts by least recently due milestone'
do
visit
project_issues_path
(
project
,
sort:
'milestone_due_later'
)
visit
project_issues_path
(
project
,
sort:
'milestone_due_later'
)
page
.
should
have_selector
(
"ul.issues-list li:first-child"
,
:text
=>
'bar'
)
page
.
should
have_selector
(
"ul.issues-list li:first-child"
,
text:
'bar'
)
end
end
end
end
describe
'combine filter and sort'
do
describe
'combine filter and sort'
do
let
(
:user2
)
{
create
(
:user
)
}
let
(
:user2
)
{
create
(
:user
)
}
before
:each
do
before
:each
do
...
@@ -170,12 +168,10 @@ describe "Issues" do
...
@@ -170,12 +168,10 @@ describe "Issues" do
it
'sorts with a filter applied'
do
it
'sorts with a filter applied'
do
visit
project_issues_path
(
project
,
sort:
'oldest'
,
assignee_id:
user2
.
id
)
visit
project_issues_path
(
project
,
sort:
'oldest'
,
assignee_id:
user2
.
id
)
page
.
should
have_selector
(
"ul.issues-list li:first-child"
,
:text
=>
'bar'
)
page
.
should
have_selector
(
"ul.issues-list li:first-child"
,
text:
'bar'
)
page
.
should
have_selector
(
"ul.issues-list li:last-child"
,
:text
=>
'foo'
)
page
.
should
have_selector
(
"ul.issues-list li:last-child"
,
text:
'foo'
)
page
.
should_not
have_content
'baz'
page
.
should_not
have_content
'baz'
end
end
end
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