kalibro_entities 0.0.1.rc3 → 0.0.1.rc4
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: dfd0bba8a6a0fd21edd89f846ee569a0ff2eda3a
|
4
|
+
data.tar.gz: 61cf1255dec08c90a1e4845a42f9ca90dcdb1e66
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 170988f3bacedb74ec5538cc825ef0f974015f97f5403eb2c9422ebef78ca194de34774401c21fc239685394e8045e8e6ce9f01690ddc34afd78854b2342b5d5
|
7
|
+
data.tar.gz: 5fc92926c881433657149be51e08694cef6db09ff6265a0e49ff59c7bdbb5d0df4193f3b30a8040992e2966c9d0ab7e66a330a5c490dddf71a51801f3d1764e8
|
@@ -22,6 +22,17 @@ module KalibroEntities
|
|
22
22
|
|
23
23
|
attr_accessor :id, :configuration, :value, :aggregated_value
|
24
24
|
|
25
|
+
def initialize(attributes={})
|
26
|
+
value = attributes[:value]
|
27
|
+
@value = (value == "NaN") ? attributes[:aggregated_value].to_f : value.to_f
|
28
|
+
attributes.each do |field, value|
|
29
|
+
if field!= :value and field!= :aggregated_value and self.class.is_valid?(field)
|
30
|
+
send("#{field}=", value)
|
31
|
+
end
|
32
|
+
end
|
33
|
+
@kalibro_errors = []
|
34
|
+
end
|
35
|
+
|
25
36
|
def id=(value)
|
26
37
|
@id = value.to_i
|
27
38
|
end
|
@@ -20,6 +20,15 @@ describe KalibroEntities::Entities::MetricResult do
|
|
20
20
|
subject { FactoryGirl.build(:metric_result) }
|
21
21
|
let(:metric_configuration_snapshot) { FactoryGirl.build(:metric_configuration_snapshot) }
|
22
22
|
|
23
|
+
describe 'new' do
|
24
|
+
context 'with value NaN' do
|
25
|
+
it 'should set the value with aggregated_value' do
|
26
|
+
metric_result = KalibroEntities::Entities::MetricResult.new( FactoryGirl.attributes_for(:metric_result, {value: "NaN", aggregated_value: 1.6}) )
|
27
|
+
metric_result.value.should eq(1.6)
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
23
32
|
describe 'id=' do
|
24
33
|
it 'should set the value of the attribute id' do
|
25
34
|
subject.id = 42
|
@@ -134,7 +143,6 @@ describe KalibroEntities::Entities::MetricResult do
|
|
134
143
|
|
135
144
|
it 'should return a list with the descendant results' do
|
136
145
|
metric_results.first.value.should eq(subject.value)
|
137
|
-
metric_results.last.aggregated_value.should eq(subject.aggregated_value)
|
138
146
|
end
|
139
147
|
end
|
140
148
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: kalibro_entities
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.1.
|
4
|
+
version: 0.0.1.rc4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Carlos Morais
|
@@ -15,7 +15,7 @@ authors:
|
|
15
15
|
autorequire:
|
16
16
|
bindir: bin
|
17
17
|
cert_chain: []
|
18
|
-
date: 2013-10-
|
18
|
+
date: 2013-10-28 00:00:00.000000000 Z
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
21
21
|
name: bundler
|
@@ -350,7 +350,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
350
350
|
version: 1.3.1
|
351
351
|
requirements: []
|
352
352
|
rubyforge_project:
|
353
|
-
rubygems_version: 2.0.
|
353
|
+
rubygems_version: 2.0.5
|
354
354
|
signing_key:
|
355
355
|
specification_version: 4
|
356
356
|
summary: KalibroEntites is a communication interface with the Kalibro service.
|