Commit 5b32355b695daa1ba3f040f212cd9e44cb1cea36
Committed by
Jefferson Fernandes
1 parent
c090295a
Exists in
master
and in
29 other branches
[Mezuro] Fixed choose_metric test in controller test
Showing
1 changed file
with
11 additions
and
1 deletions
Show diff stats
plugins/mezuro/test/functional/mezuro_plugin_profile_controller_test.rb
| @@ -16,6 +16,9 @@ class MezuroPluginProfileControllerTest < ActionController::TestCase | @@ -16,6 +16,9 @@ class MezuroPluginProfileControllerTest < ActionController::TestCase | ||
| 16 | @module_result = ModuleResultFixtures.create | 16 | @module_result = ModuleResultFixtures.create |
| 17 | @project = @project_result.project | 17 | @project = @project_result.project |
| 18 | @name = @project.name | 18 | @name = @project.name |
| 19 | + | ||
| 20 | + @collector = create_collector | ||
| 21 | + @client = Kalibro::Client::BaseToolClient.new | ||
| 19 | end | 22 | end |
| 20 | 23 | ||
| 21 | should 'not find module result for inexistent project content' do | 24 | should 'not find module result for inexistent project content' do |
| @@ -76,7 +79,8 @@ class MezuroPluginProfileControllerTest < ActionController::TestCase | @@ -76,7 +79,8 @@ class MezuroPluginProfileControllerTest < ActionController::TestCase | ||
| 76 | end | 79 | end |
| 77 | 80 | ||
| 78 | should 'assign configuration and collector name in choose_metric' do | 81 | should 'assign configuration and collector name in choose_metric' do |
| 79 | - fail "Need to mock client" | 82 | + Kalibro::Client::BaseToolClient.expects(:new).returns(@client) |
| 83 | + @client.expects(:base_tool).with(@collector.name).returns(@collector) | ||
| 80 | get :choose_metric, :profile => @profile.identifier, :configuration_name => "test name", :collector_name => "Collector A" | 84 | get :choose_metric, :profile => @profile.identifier, :configuration_name => "test name", :collector_name => "Collector A" |
| 81 | assert_equal assigns(:configuration_name), "test name" | 85 | assert_equal assigns(:configuration_name), "test name" |
| 82 | assert_equal assigns(:collector_name), "Collector A" | 86 | assert_equal assigns(:collector_name), "Collector A" |
| @@ -90,4 +94,10 @@ class MezuroPluginProfileControllerTest < ActionController::TestCase | @@ -90,4 +94,10 @@ class MezuroPluginProfileControllerTest < ActionController::TestCase | ||
| 90 | @content.save | 94 | @content.save |
| 91 | end | 95 | end |
| 92 | 96 | ||
| 97 | + def create_collector | ||
| 98 | + collector = Kalibro::Entities::BaseTool.new | ||
| 99 | + collector.name = "Collector A" | ||
| 100 | + collector.supported_metrics = [] | ||
| 101 | + collector | ||
| 102 | + end | ||
| 93 | end | 103 | end |