Commit 8f4bd8deedec6c1a80815e680b5dd547dabe1ac2
Committed by
Paulo Meireles
1 parent
53e454a3
Exists in
master
and in
29 other branches
Fix MetricResult and ModuleResultClientTest (date)
Showing
2 changed files
with
9 additions
and
4 deletions
Show diff stats
plugins/mezuro/lib/kalibro/entities/metric_result.rb
... | ... | @@ -4,8 +4,11 @@ class Kalibro::Entities::MetricResult < Kalibro::Entities::Entity |
4 | 4 | |
5 | 5 | def metric=(value) |
6 | 6 | if value.kind_of?(Hash) |
7 | - @metric = to_entity(value, Kalibro::Entities::CompoundMetric) if value.has_key?(:script) | |
8 | - @metric = to_entity(value, Kalibro::Entities::NativeMetric) | |
7 | + if value.has_key?(:script) | |
8 | + @metric = to_entity(value, Kalibro::Entities::CompoundMetric) | |
9 | + else | |
10 | + @metric = to_entity(value, Kalibro::Entities::NativeMetric) | |
11 | + end | |
9 | 12 | else |
10 | 13 | @metric = value |
11 | 14 | end | ... | ... |
plugins/mezuro/test/unit/kalibro/client/module_result_client_test.rb
... | ... | @@ -9,10 +9,12 @@ class ModuleResultClientTest < Test::Unit::TestCase |
9 | 9 | end |
10 | 10 | |
11 | 11 | should 'get module result' do |
12 | - request_body = {:project_name => 'Qt-Calculator', :module_name => 'main', :date => '42'} | |
12 | + date_string = '2012-01-10T16:07:15.442-02:00' | |
13 | + date = DateTime.parse(date_string) | |
14 | + request_body = {:project_name => 'Qt-Calculator', :module_name => 'main', :date => date_string} | |
13 | 15 | response = {:module_result => @result.to_hash} |
14 | 16 | @port.expects(:request).with(:get_module_result, request_body).returns(response) |
15 | - assert_equal @result, @client.module_result('Qt-Calculator', 'main', '42') | |
17 | + assert_equal @result, @client.module_result('Qt-Calculator', 'main', date) | |
16 | 18 | end |
17 | 19 | |
18 | 20 | should 'get result history' do | ... | ... |