From 65d89d1a6b306bb8b96c36ad61b98b371d4218bf Mon Sep 17 00:00:00 2001 From: Carlos Morais Date: Thu, 9 Feb 2012 18:32:51 -0200 Subject: [PATCH] [Mezuro] CompoundMetricFixtures --- plugins/mezuro/test/fixtures/compound_metric_fixtures.rb | 15 +++++++++++++++ plugins/mezuro/test/unit/kalibro/entities/compound_metric_test.rb | 20 +++++--------------- 2 files changed, 20 insertions(+), 15 deletions(-) create mode 100644 plugins/mezuro/test/fixtures/compound_metric_fixtures.rb diff --git a/plugins/mezuro/test/fixtures/compound_metric_fixtures.rb b/plugins/mezuro/test/fixtures/compound_metric_fixtures.rb new file mode 100644 index 0000000..51bf01c --- /dev/null +++ b/plugins/mezuro/test/fixtures/compound_metric_fixtures.rb @@ -0,0 +1,15 @@ +class CompoundMetricFixtures + + def self.sc + sc = Kalibro::Entities::CompoundMetric.new + sc.name = 'Structural Complexity' + sc.scope = 'CLASS' + sc.script = 'return cbo * lcom4;' + sc + end + + def self.sc_hash + {:name => 'Structural Complexity', :scope => 'CLASS', :script => 'return cbo * lcom4;'} + 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 index e25b3a2..721ab5a 100644 --- a/plugins/mezuro/test/unit/kalibro/entities/compound_metric_test.rb +++ b/plugins/mezuro/test/unit/kalibro/entities/compound_metric_test.rb @@ -1,22 +1,12 @@ require "test_helper" -class CompoundMetricTest < ActiveSupport::TestCase - def self.sc - sc = Kalibro::Entities::CompoundMetric.new - sc.name = 'Structural Complexity' - sc.scope = 'CLASS' - sc.script = 'return cbo * lcom4;' - sc - end +require "#{RAILS_ROOT}/plugins/mezuro/test/fixtures/compound_metric_fixtures" + +class CompoundMetricTest < ActiveSupport::TestCase - def self.sc_hash - {:name => 'Structural Complexity', :scope => 'CLASS', - :script => 'return cbo * lcom4;'} - end - def setup - @hash = self.class.sc_hash - @metric = self.class.sc + @hash = CompoundMetricFixtures.sc_hash + @metric = CompoundMetricFixtures.sc end should 'create compound metric from hash' do -- libgit2 0.21.2