Commit efe7e543f33b0a4d5c5818fb17529efb2cdcbcf1
Committed by
Carlos Morais
1 parent
c4d258c2
Exists in
master
and in
28 other branches
[Mezuro] Case when range is nil
Showing
3 changed files
with
12 additions
and
7 deletions
Show diff stats
plugins/mezuro/controllers/mezuro_plugin_profile_controller.rb
plugins/mezuro/test/functional/mezuro_plugin_profile_controller_test.rb
| ... | ... | @@ -15,6 +15,7 @@ class MezuroPluginProfileControllerTest < ActionController::TestCase |
| 15 | 15 | @module_result = ModuleResultFixtures.create |
| 16 | 16 | @project_result = ProjectResultFixtures.qt_calculator |
| 17 | 17 | @project = @project_result.project |
| 18 | + @project_content = create_project_content(@profile) | |
| 18 | 19 | end |
| 19 | 20 | |
| 20 | 21 | def test_metrics_for_unknown_project |
| ... | ... | @@ -28,13 +29,12 @@ class MezuroPluginProfileControllerTest < ActionController::TestCase |
| 28 | 29 | end |
| 29 | 30 | |
| 30 | 31 | should 'get metrics from a known module' do |
| 31 | - project_content = create_project_content(@profile) | |
| 32 | - project_name = project_content.name | |
| 32 | + project_name = @project_content.name | |
| 33 | 33 | module_name = project_name |
| 34 | 34 | Kalibro::Client::ProjectResultClient.expects(:last_result).with(project_name).returns(@project_result) |
| 35 | - Kalibro::Client::ModuleResultClient.expects(:module_result).with(project_content, module_name). | |
| 35 | + Kalibro::Client::ModuleResultClient.expects(:module_result).with(@project_content, module_name). | |
| 36 | 36 | returns(@module_result) |
| 37 | - get :metrics, :profile => @profile_id, :id => project_content.id, :module_name => module_name | |
| 37 | + get :metrics, :profile => @profile_id, :id => @project_content.id, :module_name => module_name | |
| 38 | 38 | assert_response 200 |
| 39 | 39 | # assert_tag # TODO |
| 40 | 40 | end |
| ... | ... | @@ -48,7 +48,7 @@ class MezuroPluginProfileControllerTest < ActionController::TestCase |
| 48 | 48 | Kalibro::Client::KalibroClient.expects(:process_project).with(project_content.name) |
| 49 | 49 | project_content.save |
| 50 | 50 | |
| 51 | -# MezuroPlugin::ProjectContent.any_instance.stubs(:project_content).returns(project_content) | |
| 51 | + MezuroPlugin::ProjectContent.any_instance.stubs(:project_content).returns(project_content) | |
| 52 | 52 | project_content |
| 53 | 53 | end |
| 54 | 54 | ... | ... |
plugins/mezuro/views/content_viewer/_module_result.rhtml
| ... | ... | @@ -17,11 +17,15 @@ |
| 17 | 17 | <tbody> |
| 18 | 18 | <% module_result.metric_results.each do |metric_result| %> |
| 19 | 19 | <% range = metric_result.range %> |
| 20 | - <tr title=" <%= range.comments %>"> | |
| 20 | + <tr title="<%= range.nil? ? '' : range.comments %>"> | |
| 21 | 21 | <td><%= metric_result.metric.name %></td> |
| 22 | 22 | <td><%= metric_result.value %></td> |
| 23 | 23 | <td><%= metric_result.weight %></td> |
| 24 | - <td style="background-color: #<%= range.color[2..-1] %>"><%= range.label %></td> | |
| 24 | + <% if range.nil? %> | |
| 25 | + <td></td> | |
| 26 | + <% else %> | |
| 27 | + <td style="background-color: #<%= range.color[2..-1] %>"><%= range.label %></td> | |
| 28 | + <% end %> | |
| 25 | 29 | </tr> |
| 26 | 30 | <% end %> |
| 27 | 31 | </tbody> | ... | ... |