Commit 65d89d1a6b306bb8b96c36ad61b98b371d4218bf
Committed by
Paulo Meireles
1 parent
166c9b07
Exists in
master
and in
29 other branches
[Mezuro] CompoundMetricFixtures
Showing
2 changed files
with
20 additions
and
15 deletions
Show diff stats
plugins/mezuro/test/fixtures/compound_metric_fixtures.rb
0 → 100644
| @@ -0,0 +1,15 @@ | @@ -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 | require "test_helper" | 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 | def setup | 7 | def setup |
| 18 | - @hash = self.class.sc_hash | ||
| 19 | - @metric = self.class.sc | 8 | + @hash = CompoundMetricFixtures.sc_hash |
| 9 | + @metric = CompoundMetricFixtures.sc | ||
| 20 | end | 10 | end |
| 21 | 11 | ||
| 22 | should 'create compound metric from hash' do | 12 | should 'create compound metric from hash' do |