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
ce4dad45
Commit
ce4dad45
authored
Oct 13, 2016
by
Georg G
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use test double and matchers
parent
f32bc1f5
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
6 deletions
+7
-6
spec/controllers/projects/graphs_controller_spec.rb
spec/controllers/projects/graphs_controller_spec.rb
+7
-6
No files found.
spec/controllers/projects/graphs_controller_spec.rb
View file @
ce4dad45
require
'spec_helper'
require
'ostruct'
describe
Projects
::
GraphsController
do
let
(
:project
)
{
create
(
:project
)
}
...
...
@@ -12,7 +11,7 @@ describe Projects::GraphsController do
describe
'GET #languages'
do
let
(
:linguist_repository
)
do
OpenStruct
.
new
(
languages:
{
double
(
languages:
{
'Ruby'
=>
1000
,
'CoffeeScript'
=>
350
,
'PowerShell'
=>
15
...
...
@@ -23,10 +22,10 @@ describe Projects::GraphsController do
ps_color
=
"#
#{
Digest
::
SHA256
.
hexdigest
(
'PowerShell'
)[
0
...
6
]
}
"
[
# colors from Linguist:
{
value:
73.26
,
label:
"Ruby"
,
color:
"#701516"
,
highlight:
"#701516"
},
{
value:
25.64
,
label:
"CoffeeScript"
,
color:
"#244776"
,
highlight:
"#244776"
},
{
label:
"Ruby"
,
color:
"#701516"
,
highlight:
"#701516"
},
{
label:
"CoffeeScript"
,
color:
"#244776"
,
highlight:
"#244776"
},
# colors from SHA256 fallback:
{
value:
1.1
,
label:
"PowerShell"
,
color:
ps_color
,
highlight:
ps_color
}
{
label:
"PowerShell"
,
color:
ps_color
,
highlight:
ps_color
}
]
end
...
...
@@ -37,7 +36,9 @@ describe Projects::GraphsController do
it
'sets the correct colour according to language'
do
get
(
:languages
,
namespace_id:
project
.
namespace
.
path
,
project_id:
project
.
path
,
id:
'master'
)
expect
(
assigns
(
:languages
)).
to
eq
(
expected_values
)
expected_values
.
each
do
|
val
|
expect
(
assigns
(
:languages
)).
to
include
(
include
(
val
))
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