From 34870c26b255ce842c2d39c272a7d2ce0a14bcb3 Mon Sep 17 00:00:00 2001 From: Carlos Morais Date: Thu, 9 Feb 2012 18:24:24 -0200 Subject: [PATCH] [Mezuro] native_metric_fixtures --- plugins/mezuro/test/fixtures/native_metric_fixtures.rb | 29 +++++++++++++++++++++++++++++ plugins/mezuro/test/unit/kalibro/entities/native_metric_test.rb | 33 ++++----------------------------- 2 files changed, 33 insertions(+), 29 deletions(-) create mode 100644 plugins/mezuro/test/fixtures/native_metric_fixtures.rb diff --git a/plugins/mezuro/test/fixtures/native_metric_fixtures.rb b/plugins/mezuro/test/fixtures/native_metric_fixtures.rb new file mode 100644 index 0000000..f04c1c3 --- /dev/null +++ b/plugins/mezuro/test/fixtures/native_metric_fixtures.rb @@ -0,0 +1,29 @@ +class NativeMetricFixtures + + def self.total_cof + total_cof = Kalibro::Entities::NativeMetric.new + total_cof.name = 'Total Coupling Factor' + total_cof.scope = 'APPLICATION' + total_cof.origin = 'Analizo' + total_cof.language = 'JAVA' + total_cof + end + + def self.total_cof_hash + {:name => 'Total Coupling Factor', :scope => 'APPLICATION', :origin => 'Analizo', :language => 'JAVA'} + end + + def self.amloc + total_cof = Kalibro::Entities::NativeMetric.new + total_cof.name = 'Average Method LOC' + total_cof.scope = 'CLASS' + total_cof.origin = 'Analizo' + total_cof.language = 'JAVA' + total_cof + end + + def self.amloc_hash + {:name => 'Average Method LOC', :scope => 'CLASS', :origin => 'Analizo', :language => 'JAVA'} + end + +end \ No newline at end of file diff --git a/plugins/mezuro/test/unit/kalibro/entities/native_metric_test.rb b/plugins/mezuro/test/unit/kalibro/entities/native_metric_test.rb index f788389..8625d76 100644 --- a/plugins/mezuro/test/unit/kalibro/entities/native_metric_test.rb +++ b/plugins/mezuro/test/unit/kalibro/entities/native_metric_test.rb @@ -1,37 +1,12 @@ require "test_helper" -class NativeMetricTest < ActiveSupport::TestCase - - def self.total_cof - total_cof = Kalibro::Entities::NativeMetric.new - total_cof.name = 'Total Coupling Factor' - total_cof.scope = 'APPLICATION' - total_cof.origin = 'Analizo' - total_cof.language = 'JAVA' - total_cof - end - def self.amloc - total_cof = Kalibro::Entities::NativeMetric.new - total_cof.name = 'Average Method LOC' - total_cof.scope = 'CLASS' - total_cof.origin = 'Analizo' - total_cof.language = 'JAVA' - total_cof - end +require "#{RAILS_ROOT}/plugins/mezuro/test/fixtures/native_metric_fixtures" - def self.total_cof_hash - {:name => 'Total Coupling Factor', :scope => 'APPLICATION', - :origin => 'Analizo', :language => 'JAVA'} - end +class NativeMetricTest < ActiveSupport::TestCase - def self.amloc_hash - {:name => 'Average Method LOC', :scope => 'CLASS', - :origin => 'Analizo', :language => 'JAVA'} - end - def setup - @hash = self.class.amloc_hash - @metric = self.class.amloc + @hash = NativeMetricFixtures.amloc_hash + @metric = NativeMetricFixtures.amloc end should 'create native metric from hash' do -- libgit2 0.21.2