diff --git a/plugins/mezuro/lib/kalibro/compound_metric.rb b/plugins/mezuro/lib/kalibro/compound_metric.rb new file mode 100644 index 0000000..c9f4a1d --- /dev/null +++ b/plugins/mezuro/lib/kalibro/compound_metric.rb @@ -0,0 +1,5 @@ +class Kalibro::CompoundMetric < Kalibro::Metric + + attr_accessor :script + +end diff --git a/plugins/mezuro/lib/kalibro/entities/compound_metric.rb b/plugins/mezuro/lib/kalibro/entities/compound_metric.rb deleted file mode 100644 index 6e56463..0000000 --- a/plugins/mezuro/lib/kalibro/entities/compound_metric.rb +++ /dev/null @@ -1,5 +0,0 @@ -class Kalibro::Entities::CompoundMetric < Kalibro::Entities::Metric - - attr_accessor :script - -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 a997d61..a5a87f7 100644 --- a/plugins/mezuro/test/fixtures/compound_metric_fixtures.rb +++ b/plugins/mezuro/test/fixtures/compound_metric_fixtures.rb @@ -1,15 +1,10 @@ class CompoundMetricFixtures - def self.sc - sc = Kalibro::Entities::CompoundMetric.new - sc.description = 'Calculate the Structural Complexity of the Code' - sc.name = 'Structural Complexity' - sc.scope = 'CLASS' - sc.script = 'return 42;' - sc + def self.compound_metric + Kalibro::CompoundMetric.new compound_metric_hash end - def self.sc_hash + def self.compound_metric_hash {:name => 'Structural Complexity', :scope => 'CLASS', :script => 'return 42;', :description => 'Calculate the Structural Complexity of the Code'} end diff --git a/plugins/mezuro/test/unit/kalibro/compound_metric_test.rb b/plugins/mezuro/test/unit/kalibro/compound_metric_test.rb new file mode 100644 index 0000000..c3437d2 --- /dev/null +++ b/plugins/mezuro/test/unit/kalibro/compound_metric_test.rb @@ -0,0 +1,20 @@ +require "test_helper" + +require "#{RAILS_ROOT}/plugins/mezuro/test/fixtures/compound_metric_fixtures" + +class CompoundMetricTest < ActiveSupport::TestCase + + def setup + @hash = CompoundMetricFixtures.compound_metric_hash + @metric = CompoundMetricFixtures.compound_metric + end + + should 'create compound metric from hash' do + assert_equal @hash[:script], Kalibro::CompoundMetric.new(@hash).script + end + + should 'convert compound metric to hash' do + assert_equal @hash, @metric.to_hash + end + +end diff --git a/plugins/mezuro/test/unit/kalibro/entities/compound_metric_test.rb b/plugins/mezuro/test/unit/kalibro/entities/compound_metric_test.rb deleted file mode 100644 index 721ab5a..0000000 --- a/plugins/mezuro/test/unit/kalibro/entities/compound_metric_test.rb +++ /dev/null @@ -1,20 +0,0 @@ -require "test_helper" - -require "#{RAILS_ROOT}/plugins/mezuro/test/fixtures/compound_metric_fixtures" - -class CompoundMetricTest < ActiveSupport::TestCase - - def setup - @hash = CompoundMetricFixtures.sc_hash - @metric = CompoundMetricFixtures.sc - end - - should 'create compound metric from hash' do - assert_equal @metric, Kalibro::Entities::CompoundMetric.from_hash(@hash) - end - - should 'convert compound metric to hash' do - assert_equal @hash, @metric.to_hash - end - -end \ No newline at end of file -- libgit2 0.21.2