Commit 166c9b0725586b4c3ecfe4a71b67b36849b34a32
Committed by
Paulo Meireles
1 parent
34870c26
Exists in
master
and in
29 other branches
[Mezuro] BaseToolFixtures
Showing
2 changed files
with
22 additions
and
17 deletions
Show diff stats
| @@ -0,0 +1,18 @@ | @@ -0,0 +1,18 @@ | ||
| 1 | +class BaseToolFixtures | ||
| 2 | + | ||
| 3 | + def self.analizo | ||
| 4 | + base_tool = Kalibro::Entities::BaseTool.new | ||
| 5 | + base_tool.name = 'Analizo' | ||
| 6 | + base_tool.supported_metrics = [ | ||
| 7 | + NativeMetricFixtures.total_cof, | ||
| 8 | + NativeMetricFixtures.amloc] | ||
| 9 | + base_tool | ||
| 10 | + end | ||
| 11 | + | ||
| 12 | + def self.analizo_hash | ||
| 13 | + {:name => 'Analizo', :supported_metric => [ | ||
| 14 | + NativeMetricFixtures.total_cof_hash, | ||
| 15 | + NativeMetricFixtures.amloc_hash]} | ||
| 16 | + end | ||
| 17 | + | ||
| 18 | +end |
plugins/mezuro/test/unit/kalibro/entities/base_tool_test.rb
| 1 | require "test_helper" | 1 | require "test_helper" |
| 2 | -class BaseToolTest < ActiveSupport::TestCase | ||
| 3 | 2 | ||
| 4 | - def self.analizo | ||
| 5 | - total_cof = NativeMetricTest.total_cof | ||
| 6 | - amloc = NativeMetricTest.amloc | ||
| 7 | - base_tool = Kalibro::Entities::BaseTool.new | ||
| 8 | - base_tool.name = 'Analizo' | ||
| 9 | - base_tool.supported_metrics = [total_cof, amloc] | ||
| 10 | - base_tool | ||
| 11 | - end | 3 | +require "#{RAILS_ROOT}/plugins/mezuro/test/fixtures/base_tool_fixtures" |
| 12 | 4 | ||
| 13 | - def self.analizo_hash | ||
| 14 | - total_cof_hash = NativeMetricTest.total_cof_hash | ||
| 15 | - amloc_hash = NativeMetricTest.amloc_hash | ||
| 16 | - {:name => 'Analizo', | ||
| 17 | - :supported_metric => [total_cof_hash, amloc_hash]} | ||
| 18 | - end | 5 | +class BaseToolTest < ActiveSupport::TestCase |
| 19 | 6 | ||
| 20 | def setup | 7 | def setup |
| 21 | - @hash = self.class.analizo_hash | ||
| 22 | - @base_tool = self.class.analizo | 8 | + @hash = BaseToolFixtures.analizo_hash |
| 9 | + @base_tool = BaseToolFixtures.analizo | ||
| 23 | end | 10 | end |
| 24 | 11 | ||
| 25 | should 'create base tool from hash' do | 12 | should 'create base tool from hash' do |