Commit 9843d7f9aa4d2978eaa96cc4d44d0ffff6c6b925

Authored by Diego Camarinha
Committed by Diego Camarinha
1 parent d17ae011

[Mezuro] Corrected some tests.

plugins/mezuro/test/functional/profile/mezuro_plugin_module_result_controller_test.rb
@@ -38,7 +38,7 @@ class MezuroPluginModuleResultControllerTest < ActionController::TestCase @@ -38,7 +38,7 @@ class MezuroPluginModuleResultControllerTest < ActionController::TestCase
38 38
39 should 'get metric result history' do 39 should 'get metric result history' do
40 metric_name = @metric_result_hash[:configuration][:metric][:name] 40 metric_name = @metric_result_hash[:configuration][:metric][:name]
41 - Kalibro::MetricResult.expects(:request).with(:history_of, { :metric_name => metric_name, :module_result_id => @module_result_hash[:id] }). 41 + Kalibro::MetricResult.expects(:request).with(:history_of_metric, { :metric_name => metric_name, :module_result_id => @module_result_hash[:id] }).
42 returns({:date_metric_result => @date_metric_result_hash}) 42 returns({:date_metric_result => @date_metric_result_hash})
43 get :metric_result_history, :profile => @profile.identifier, :module_result_id => @module_result_hash[:id], :metric_name => metric_name 43 get :metric_result_history, :profile => @profile.identifier, :module_result_id => @module_result_hash[:id], :metric_name => metric_name
44 assert_equal DateTime.parse(@date_metric_result_hash[:date]), assigns(:history).first.date 44 assert_equal DateTime.parse(@date_metric_result_hash[:date]), assigns(:history).first.date
plugins/mezuro/test/unit/kalibro/metric_result_test.rb
@@ -33,7 +33,7 @@ class MetricResultTest < ActiveSupport::TestCase @@ -33,7 +33,7 @@ class MetricResultTest < ActiveSupport::TestCase
33 33
34 should 'return history of a metric with a module result id' do 34 should 'return history of a metric with a module result id' do
35 module_result_id = 31 35 module_result_id = 31
36 - Kalibro::MetricResult.expects(:request).with(:history_of, {:metric_name => @result.configuration.metric.name, :module_result_id => module_result_id}).returns({:date_metric_result => DateMetricResultFixtures.date_metric_result_hash}) 36 + Kalibro::MetricResult.expects(:request).with(:history_of_metric, {:metric_name => @result.configuration.metric.name, :module_result_id => module_result_id}).returns({:date_metric_result => DateMetricResultFixtures.date_metric_result_hash})
37 assert_equal DateMetricResultFixtures.date_metric_result_hash[:metric_result][:id], Kalibro::MetricResult.history_of(@result.configuration.metric.name, module_result_id).first.metric_result.id 37 assert_equal DateMetricResultFixtures.date_metric_result_hash[:metric_result][:id], Kalibro::MetricResult.history_of(@result.configuration.metric.name, module_result_id).first.metric_result.id
38 end 38 end
39 39
plugins/mezuro/views/mezuro_plugin_module_result/_metric_results.rhtml
@@ -9,18 +9,17 @@ @@ -9,18 +9,17 @@
9 <tbody> 9 <tbody>
10 <% @metric_results.each do |metric_result| %> 10 <% @metric_results.each do |metric_result| %>
11 <% metric_configuration_snapshot = metric_result.metric_configuration_snapshot%> 11 <% metric_configuration_snapshot = metric_result.metric_configuration_snapshot%>
12 - <% range_snapshots = metric_configuration_snapshot.range_snapshot %> 12 + <% range_snapshot = metric_configuration_snapshot.range_snapshot %>
13 <% formatted_name = MezuroPlugin::Helpers::ContentViewerHelper.format_name(metric_configuration_snapshot) %> 13 <% formatted_name = MezuroPlugin::Helpers::ContentViewerHelper.format_name(metric_configuration_snapshot) %>
14 - <% if !range_snapshots.nil? %> 14 + <% if !range_snapshot.nil? %>
15 <tr> 15 <tr>
16 <td style="width: 74%"><a href="#" show-metric-history="<%= formatted_name %>" data-module-id="<%= @module_result.id %>"><%= metric_configuration_snapshot.metric.name %></a></td> 16 <td style="width: 74%"><a href="#" show-metric-history="<%= formatted_name %>" data-module-id="<%= @module_result.id %>"><%= metric_configuration_snapshot.metric.name %></a></td>
17 <td><%= MezuroPlugin::Helpers::ContentViewerHelper.format_grade(metric_result.value) %></td> 17 <td><%= MezuroPlugin::Helpers::ContentViewerHelper.format_grade(metric_result.value) %></td>
18 <td><%= metric_configuration_snapshot.weight %></td> 18 <td><%= metric_configuration_snapshot.weight %></td>
19 - <% range_snapshots.each do |range_snapshot| %>  
20 - <% if range_snapshot[:beginning].to_f <= metric_result.value and range_snapshot[:end].to_f > metric_result.value %>  
21 - <td style="background-color: #<%= range_snapshot[:color] %>">  
22 - <span title="<%= range_snapshot[:comments] %>" >  
23 - <%= range_snapshot[:label] %> 19 + <% if range_snapshot.beginning.to_f <= metric_result.value and range_snapshot.end.to_f > metric_result.value %>
  20 + <td style="background-color: #<%= range_snapshot.color %>">
  21 + <span title="<%= range_snapshot.comments %>" >
  22 + <%= range_snapshot.label %>
24 </span> 23 </span>
25 </td> 24 </td>
26 </tr> 25 </tr>
@@ -30,11 +29,10 @@ @@ -30,11 +29,10 @@
30 </div> 29 </div>
31 </td> 30 </td>
32 <td align="right"> 31 <td align="right">
33 - <%= range_snapshot[:comments].nil? ? '' : range_snapshot[:comments] %> 32 + <%= range_snapshot.comments.nil? ? '' : range_snapshot.comments %>
34 </td> 33 </td>
35 </tr> 34 </tr>
36 <% end %> 35 <% end %>
37 - <% end %>  
38 <% end %> 36 <% end %>
39 <% end %> 37 <% end %>
40 </tbody> 38 </tbody>