From 166c9b0725586b4c3ecfe4a71b67b36849b34a32 Mon Sep 17 00:00:00 2001 From: Carlos Morais Date: Thu, 9 Feb 2012 18:29:46 -0200 Subject: [PATCH] [Mezuro] BaseToolFixtures --- plugins/mezuro/test/fixtures/base_tool_fixtures.rb | 18 ++++++++++++++++++ plugins/mezuro/test/unit/kalibro/entities/base_tool_test.rb | 21 ++++----------------- 2 files changed, 22 insertions(+), 17 deletions(-) create mode 100644 plugins/mezuro/test/fixtures/base_tool_fixtures.rb diff --git a/plugins/mezuro/test/fixtures/base_tool_fixtures.rb b/plugins/mezuro/test/fixtures/base_tool_fixtures.rb new file mode 100644 index 0000000..7a88eac --- /dev/null +++ b/plugins/mezuro/test/fixtures/base_tool_fixtures.rb @@ -0,0 +1,18 @@ +class BaseToolFixtures + + def self.analizo + base_tool = Kalibro::Entities::BaseTool.new + base_tool.name = 'Analizo' + base_tool.supported_metrics = [ + NativeMetricFixtures.total_cof, + NativeMetricFixtures.amloc] + base_tool + end + + def self.analizo_hash + {:name => 'Analizo', :supported_metric => [ + NativeMetricFixtures.total_cof_hash, + NativeMetricFixtures.amloc_hash]} + end + +end diff --git a/plugins/mezuro/test/unit/kalibro/entities/base_tool_test.rb b/plugins/mezuro/test/unit/kalibro/entities/base_tool_test.rb index ba6ec21..1df692e 100644 --- a/plugins/mezuro/test/unit/kalibro/entities/base_tool_test.rb +++ b/plugins/mezuro/test/unit/kalibro/entities/base_tool_test.rb @@ -1,25 +1,12 @@ require "test_helper" -class BaseToolTest < ActiveSupport::TestCase - def self.analizo - total_cof = NativeMetricTest.total_cof - amloc = NativeMetricTest.amloc - base_tool = Kalibro::Entities::BaseTool.new - base_tool.name = 'Analizo' - base_tool.supported_metrics = [total_cof, amloc] - base_tool - end +require "#{RAILS_ROOT}/plugins/mezuro/test/fixtures/base_tool_fixtures" - def self.analizo_hash - total_cof_hash = NativeMetricTest.total_cof_hash - amloc_hash = NativeMetricTest.amloc_hash - {:name => 'Analizo', - :supported_metric => [total_cof_hash, amloc_hash]} - end +class BaseToolTest < ActiveSupport::TestCase def setup - @hash = self.class.analizo_hash - @base_tool = self.class.analizo + @hash = BaseToolFixtures.analizo_hash + @base_tool = BaseToolFixtures.analizo end should 'create base tool from hash' do -- libgit2 0.21.2