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
dc3d40ff
Commit
dc3d40ff
authored
Jan 02, 2017
by
Mike Greiling
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
prefer unit test on model over view test
parent
1c5a5065
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
35 deletions
+22
-35
commit_status_spec.rb
spec/models/commit_status_spec.rb
+22
-0
show.html.haml_spec.rb
spec/views/projects/pipelines/show.html.haml_spec.rb
+0
-35
No files found.
spec/models/commit_status_spec.rb
View file @
dc3d40ff
...
@@ -243,4 +243,26 @@ describe CommitStatus, models: true do
...
@@ -243,4 +243,26 @@ describe CommitStatus, models: true do
.
to
be_a
Gitlab
::
Ci
::
Status
::
Success
.
to
be_a
Gitlab
::
Ci
::
Status
::
Success
end
end
end
end
describe
'#sortable_name'
do
subject
{
commit_status
.
sortable_name
}
tests
=
{
'karma'
=>
[
'karma'
],
'karma 0 20'
=>
[
'karma '
,
0
,
' '
,
20
],
'karma 10 20'
=>
[
'karma '
,
10
,
' '
,
20
],
'karma 50:100'
=>
[
'karma '
,
50
,
':'
,
100
],
'karma 1.10'
=>
[
'karma '
,
1
,
'.'
,
10
],
'karma 1.5.1'
=>
[
'karma '
,
1
,
'.'
,
5
,
'.'
,
1
],
'karma 1 a'
=>
[
'karma '
,
1
,
' a'
]
}
tests
.
each
do
|
name
,
sortable_name
|
it
"'
#{
name
}
' sorts as '
#{
sortable_name
}
'"
do
commit_status
.
name
=
name
is_expected
.
to
eq
(
sortable_name
)
end
end
end
end
end
spec/views/projects/pipelines/show.html.haml_spec.rb
View file @
dc3d40ff
...
@@ -45,41 +45,6 @@ describe 'projects/pipelines/show' do
...
@@ -45,41 +45,6 @@ describe 'projects/pipelines/show' do
expect
(
rendered
).
to
have_text
(
'jenkins'
)
expect
(
rendered
).
to
have_text
(
'jenkins'
)
end
end
it
'lists builds in the correct sort order'
do
create_build
(
'test'
,
1
,
'karma 0 20'
,
:created
)
create_build
(
'test'
,
1
,
'karma 12 20'
,
:created
)
create_build
(
'test'
,
1
,
'karma 1 20'
,
:created
)
create_build
(
'test'
,
1
,
'karma 10 20'
,
:created
)
create_build
(
'test'
,
1
,
'karma 11 20'
,
:created
)
create_build
(
'test'
,
1
,
'karma 2 20'
,
:created
)
create_build
(
'test'
,
1
,
'test 1.10'
,
:created
)
create_build
(
'test'
,
1
,
'test 1.5.1'
,
:created
)
create_build
(
'test'
,
1
,
'test 1 a'
,
:created
)
render
# spaced builds order
expected_order_1
=
[
'karma 0 20'
,
'karma 1 20'
,
'karma 2 20'
,
'karma 10 20'
,
'karma 11 20'
,
'karma 12 20'
].
join
(
' '
)
expect
(
rendered
).
to
have_text
(
expected_order_1
)
# decimal builds order
expected_order_2
=
[
'test 1 a'
,
'test 1.5.1'
,
'test 1.10'
].
join
(
' '
)
expect
(
rendered
).
to
have_text
(
expected_order_2
)
end
private
private
def
create_build
(
stage
,
stage_idx
,
name
,
status
)
def
create_build
(
stage
,
stage_idx
,
name
,
status
)
...
...
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