Hey Martyn,
Looks good, but I have a few comments:
First, please add a commit message explaining what the bug was -- so
that the history will be more readable.
Second, that fix broke two tests that expect no match when frontend
property is lower than that of the backend.
Here's the output:
$ rake spec
(in /home/tsedovic/aeolus/conductor/src)
...........................................................................................................................................FF............................................
1)
'HardwareProfile should correctly match a front end hardware
profile with a back end hardware profile' FAILED
expected: false,
got: true (using ==)
./spec/models/hardware_profile_spec.rb:161:
2)
'HardwareProfile should correctly match front end hardware profile
properties with back end hardware profile properties' FAILED
expected: false,
got: true (using ==)
./spec/models/hardware_profile_spec.rb:181:
Finished in 533.536125 seconds
185 examples, 2 failures
rake aborted!
The last comment is inline.
Thanks,
Thomas
On 03/04/2011 07:29 PM, mtaylor(a)redhat.com wrote:
From: Martyn Taylor<mtaylor(a)redhat.com>
---
src/app/models/hardware_profile.rb | 3 +--
1 files changed, 1 insertions(+), 2 deletions(-)
diff --git a/src/app/models/hardware_profile.rb b/src/app/models/hardware_profile.rb
index 75a501b..9cfc770 100644
--- a/src/app/models/hardware_profile.rb
+++ b/src/app/models/hardware_profile.rb
@@ -191,8 +191,7 @@ class HardwareProfile< ActiveRecord::Base
when "fixed"
match = BigDecimal.new(back_end_property.value.to_s)>=
BigDecimal.new(front_end_property.value.to_s) ? true : false
when "range"
- match = BigDecimal.new(back_end_property.range_last.to_s)>=
BigDecimal.new(front_end_property.value.to_s)&&
- BigDecimal.new(back_end_property.range_first.to_s)<=
BigDecimal.new(front_end_property.value.to_s) ? true : false
+ match = BigDecimal.new(back_end_property.range_last.to_s)>=
BigDecimal.new(front_end_property.value.to_s) ? true : false
I think you can drop the `? :` operator and just return the expression.
Like this:
match = BigDecimal.new(back_end_property.range_last.to_s)>=
BigDecimal.new(front_end_property.value.to_s)
It should do the same thing but it's shorter.
when "enum"
create_array_from_property(back_end_property).each do |value|
if BigDecimal.new(value)>= BigDecimal.new(front_end_property.value.to_s)