Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorg G <nilsding@nilsding.org>2016-10-13 08:01:34 +0300
committerGeorg G <nilsding@nilsding.org>2016-10-13 08:01:34 +0300
commitce4dad45557888066733bb20470bf56b87d4c8b7 (patch)
tree1383d357f82a2730eb41462566283486f57f0a0d /spec/controllers/projects/graphs_controller_spec.rb
parentf32bc1f52662664048876b27e181a1cacda02580 (diff)
Use test double and matchers
Diffstat (limited to 'spec/controllers/projects/graphs_controller_spec.rb')
-rw-r--r--spec/controllers/projects/graphs_controller_spec.rb13
1 files changed, 7 insertions, 6 deletions
diff --git a/spec/controllers/projects/graphs_controller_spec.rb b/spec/controllers/projects/graphs_controller_spec.rb
index 3f4535b7a24..dd743356145 100644
--- a/spec/controllers/projects/graphs_controller_spec.rb
+++ b/spec/controllers/projects/graphs_controller_spec.rb
@@ -1,5 +1,4 @@
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