diff --git a/plugins/mezuro/lib/kalibro/entities/entity.rb b/plugins/mezuro/lib/kalibro/entities/entity.rb index 0becd38..0e6adbb 100644 --- a/plugins/mezuro/lib/kalibro/entities/entity.rb +++ b/plugins/mezuro/lib/kalibro/entities/entity.rb @@ -2,7 +2,7 @@ class Kalibro::Entities::Entity def self.from_hash(hash) entity = self.new - hash.each { |field, value| entity.set(field, value) if field != :attributes!} + hash.each { |field, value| entity.set(field, value) if field.to_s[0] != '@'} entity end diff --git a/plugins/mezuro/lib/kalibro/entities/range.rb b/plugins/mezuro/lib/kalibro/entities/range.rb index 6a86528..d6eafed 100644 --- a/plugins/mezuro/lib/kalibro/entities/range.rb +++ b/plugins/mezuro/lib/kalibro/entities/range.rb @@ -12,4 +12,8 @@ class Kalibro::Entities::Range < Kalibro::Entities::Entity @end = 1.0/0.0 if value == "INF" end + def grade=(value) + @grade = value.to_f + end + end \ No newline at end of file diff --git a/plugins/mezuro/test/fixtures/compound_metric_fixtures.rb b/plugins/mezuro/test/fixtures/compound_metric_fixtures.rb index 51bf01c..58cecd7 100644 --- a/plugins/mezuro/test/fixtures/compound_metric_fixtures.rb +++ b/plugins/mezuro/test/fixtures/compound_metric_fixtures.rb @@ -4,12 +4,12 @@ class CompoundMetricFixtures sc = Kalibro::Entities::CompoundMetric.new sc.name = 'Structural Complexity' sc.scope = 'CLASS' - sc.script = 'return cbo * lcom4;' + sc.script = 'return 42;' sc end def self.sc_hash - {:name => 'Structural Complexity', :scope => 'CLASS', :script => 'return cbo * lcom4;'} + {:name => 'Structural Complexity', :scope => 'CLASS', :script => 'return 42;'} end end diff --git a/plugins/mezuro/test/functional/echo_port_test.rb b/plugins/mezuro/test/functional/echo_port_test.rb index f568f9f..3739250 100644 --- a/plugins/mezuro/test/functional/echo_port_test.rb +++ b/plugins/mezuro/test/functional/echo_port_test.rb @@ -1,6 +1,7 @@ require "test_helper" require "#{RAILS_ROOT}/plugins/mezuro/test/fixtures/base_tool_fixtures" +require "#{RAILS_ROOT}/plugins/mezuro/test/fixtures/configuration_fixtures" class EchoPortTest < ActiveSupport::TestCase @@ -16,5 +17,12 @@ class EchoPortTest < ActiveSupport::TestCase base_tool.name = "echo " + base_tool.name assert_equal base_tool, Kalibro::Entities::BaseTool.from_hash(echoed) end + + should 'echo configuration' do + configuration = ConfigurationFixtures.kalibro_configuration + echoed = @port.request(:echo_configuration, {:configuration => configuration.to_hash})[:configuration] + configuration.name = "echo " + configuration.name + assert_equal configuration, Kalibro::Entities::Configuration.from_hash(echoed) + end end \ No newline at end of file -- libgit2 0.21.2