Commit 826d5514d959e17f702992e333a6e22a200d7852

Authored by Carlos Morais
1 parent 2cb8a343

CompoundMetricFixtures

plugins/mezuro/test/fixtures/compound_metric_fixtures.rb 0 → 100644
... ... @@ -0,0 +1,15 @@
  1 +class CompoundMetricFixtures
  2 +
  3 + def self.sc
  4 + sc = Kalibro::Entities::CompoundMetric.new
  5 + sc.name = 'Structural Complexity'
  6 + sc.scope = 'CLASS'
  7 + sc.script = 'return cbo * lcom4;'
  8 + sc
  9 + end
  10 +
  11 + def self.sc_hash
  12 + {:name => 'Structural Complexity', :scope => 'CLASS', :script => 'return cbo * lcom4;'}
  13 + end
  14 +
  15 +end
... ...
plugins/mezuro/test/unit/kalibro/entities/compound_metric_test.rb
1 1 require "test_helper"
2   -class CompoundMetricTest < ActiveSupport::TestCase
3 2  
4   - def self.sc
5   - sc = Kalibro::Entities::CompoundMetric.new
6   - sc.name = 'Structural Complexity'
7   - sc.scope = 'CLASS'
8   - sc.script = 'return cbo * lcom4;'
9   - sc
10   - end
  3 +require "#{RAILS_ROOT}/plugins/mezuro/test/fixtures/compound_metric_fixtures"
  4 +
  5 +class CompoundMetricTest < ActiveSupport::TestCase
11 6  
12   - def self.sc_hash
13   - {:name => 'Structural Complexity', :scope => 'CLASS',
14   - :script => 'return cbo * lcom4;'}
15   - end
16   -
17 7 def setup
18   - @hash = self.class.sc_hash
19   - @metric = self.class.sc
  8 + @hash = CompoundMetricFixtures.sc_hash
  9 + @metric = CompoundMetricFixtures.sc
20 10 end
21 11  
22 12 should 'create compound metric from hash' do
... ...