Commit ff07e776442204e6c2ddfa59b03709962176397d

Authored by Carlos Morais + Eduardo Morais
Committed by Carlos Morais
1 parent 6669178c

[mezuro] Fix Range and update Entity for new Savon

plugins/mezuro/lib/kalibro/entities/entity.rb
@@ -2,7 +2,7 @@ class Kalibro::Entities::Entity @@ -2,7 +2,7 @@ class Kalibro::Entities::Entity
2 2
3 def self.from_hash(hash) 3 def self.from_hash(hash)
4 entity = self.new 4 entity = self.new
5 - hash.each { |field, value| entity.set(field, value) if field != :attributes!} 5 + hash.each { |field, value| entity.set(field, value) if field.to_s[0] != '@'}
6 entity 6 entity
7 end 7 end
8 8
plugins/mezuro/lib/kalibro/entities/range.rb
@@ -12,4 +12,8 @@ class Kalibro::Entities::Range < Kalibro::Entities::Entity @@ -12,4 +12,8 @@ class Kalibro::Entities::Range < Kalibro::Entities::Entity
12 @end = 1.0/0.0 if value == "INF" 12 @end = 1.0/0.0 if value == "INF"
13 end 13 end
14 14
  15 + def grade=(value)
  16 + @grade = value.to_f
  17 + end
  18 +
15 end 19 end
16 \ No newline at end of file 20 \ No newline at end of file
plugins/mezuro/test/fixtures/compound_metric_fixtures.rb
@@ -4,12 +4,12 @@ class CompoundMetricFixtures @@ -4,12 +4,12 @@ class CompoundMetricFixtures
4 sc = Kalibro::Entities::CompoundMetric.new 4 sc = Kalibro::Entities::CompoundMetric.new
5 sc.name = 'Structural Complexity' 5 sc.name = 'Structural Complexity'
6 sc.scope = 'CLASS' 6 sc.scope = 'CLASS'
7 - sc.script = 'return cbo * lcom4;' 7 + sc.script = 'return 42;'
8 sc 8 sc
9 end 9 end
10 10
11 def self.sc_hash 11 def self.sc_hash
12 - {:name => 'Structural Complexity', :scope => 'CLASS', :script => 'return cbo * lcom4;'} 12 + {:name => 'Structural Complexity', :scope => 'CLASS', :script => 'return 42;'}
13 end 13 end
14 14
15 end 15 end
plugins/mezuro/test/functional/echo_port_test.rb
1 require "test_helper" 1 require "test_helper"
2 2
3 require "#{RAILS_ROOT}/plugins/mezuro/test/fixtures/base_tool_fixtures" 3 require "#{RAILS_ROOT}/plugins/mezuro/test/fixtures/base_tool_fixtures"
  4 +require "#{RAILS_ROOT}/plugins/mezuro/test/fixtures/configuration_fixtures"
4 5
5 class EchoPortTest < ActiveSupport::TestCase 6 class EchoPortTest < ActiveSupport::TestCase
6 7
@@ -16,5 +17,12 @@ class EchoPortTest &lt; ActiveSupport::TestCase @@ -16,5 +17,12 @@ class EchoPortTest &lt; ActiveSupport::TestCase
16 base_tool.name = "echo " + base_tool.name 17 base_tool.name = "echo " + base_tool.name
17 assert_equal base_tool, Kalibro::Entities::BaseTool.from_hash(echoed) 18 assert_equal base_tool, Kalibro::Entities::BaseTool.from_hash(echoed)
18 end 19 end
  20 +
  21 + should 'echo configuration' do
  22 + configuration = ConfigurationFixtures.kalibro_configuration
  23 + echoed = @port.request(:echo_configuration, {:configuration => configuration.to_hash})[:configuration]
  24 + configuration.name = "echo " + configuration.name
  25 + assert_equal configuration, Kalibro::Entities::Configuration.from_hash(echoed)
  26 + end
19 27
20 end 28 end
21 \ No newline at end of file 29 \ No newline at end of file