Commit 39b9ebc78f292e2cd34575d460eb624fa52b7073
1 parent
b197b733
Exists in
master
and in
22 other branches
MetricConfigurationFixtures
Showing
2 changed files
with
36 additions
and
35 deletions
Show diff stats
plugins/mezuro/test/fixtures/metric_configuration_fixtures.rb
0 → 100644
| @@ -0,0 +1,32 @@ | @@ -0,0 +1,32 @@ | ||
| 1 | +class MetricConfigurationFixtures | ||
| 2 | + | ||
| 3 | + def self.amloc_configuration | ||
| 4 | + amloc = Kalibro::Entities::MetricConfiguration.new | ||
| 5 | + amloc.metric = NativeMetricFixtures.amloc | ||
| 6 | + amloc.code = 'amloc' | ||
| 7 | + amloc.weight = 1.0 | ||
| 8 | + amloc.aggregation_form = 'AVERAGE' | ||
| 9 | + amloc.ranges = [RangeFixtures.amloc_excellent, RangeFixtures.amloc_bad] | ||
| 10 | + amloc | ||
| 11 | + end | ||
| 12 | + | ||
| 13 | + def self.sc_configuration | ||
| 14 | + sc = Kalibro::Entities::MetricConfiguration.new | ||
| 15 | + sc.metric = CompoundMetricFixtures.sc | ||
| 16 | + sc.code = 'sc' | ||
| 17 | + sc.weight = 1.0 | ||
| 18 | + sc.aggregation_form = 'AVERAGE' | ||
| 19 | + sc | ||
| 20 | + end | ||
| 21 | + | ||
| 22 | + def self.amloc_configuration_hash | ||
| 23 | + {:metric => NativeMetricFixtures.amloc_hash, :code => 'amloc', :weight => 1.0, | ||
| 24 | + :aggregation_form => 'AVERAGE', :range => | ||
| 25 | + [RangeFixtures.amloc_excellent_hash, RangeFixtures.amloc_bad_hash]} | ||
| 26 | + end | ||
| 27 | + | ||
| 28 | + def self.sc_configuration_hash | ||
| 29 | + {:metric => CompoundMetricFixtures.sc_hash, :code => 'sc', :weight => 1.0, :aggregation_form => 'AVERAGE'} | ||
| 30 | + end | ||
| 31 | + | ||
| 32 | +end |
plugins/mezuro/test/unit/kalibro/entities/metric_configuration_test.rb
| 1 | require "test_helper" | 1 | require "test_helper" |
| 2 | -class MetricConfigurationTest < ActiveSupport::TestCase | ||
| 3 | - | ||
| 4 | - def self.amloc_configuration | ||
| 5 | - range1 = RangeTest.amloc_excellent | ||
| 6 | - range2 = RangeTest.amloc_bad | ||
| 7 | - amloc = Kalibro::Entities::MetricConfiguration.new | ||
| 8 | - amloc.metric = NativeMetricTest.amloc | ||
| 9 | - amloc.code = 'amloc' | ||
| 10 | - amloc.weight = 1.0 | ||
| 11 | - amloc.aggregation_form = 'AVERAGE' | ||
| 12 | - amloc.ranges = [range1, range2] | ||
| 13 | - amloc | ||
| 14 | - end | ||
| 15 | - | ||
| 16 | - def self.sc_configuration | ||
| 17 | - sc = Kalibro::Entities::MetricConfiguration.new | ||
| 18 | - sc.metric = CompoundMetricTest.sc | ||
| 19 | - sc.code = 'sc' | ||
| 20 | - sc.weight = 1.0 | ||
| 21 | - sc.aggregation_form = 'AVERAGE' | ||
| 22 | - sc | ||
| 23 | - end | ||
| 24 | 2 | ||
| 25 | - def self.amloc_configuration_hash | ||
| 26 | - range1 = RangeTest.amloc_excellent_hash | ||
| 27 | - range2 = RangeTest.amloc_bad_hash | ||
| 28 | - {:metric => NativeMetricTest.amloc_hash, | ||
| 29 | - :code => 'amloc', :weight => 1.0, :aggregation_form => 'AVERAGE', | ||
| 30 | - :range => [range1, range2]} | ||
| 31 | - end | 3 | +require "#{RAILS_ROOT}/plugins/mezuro/test/fixtures/metric_configuration_fixtures" |
| 32 | 4 | ||
| 33 | - def self.sc_configuration_hash | ||
| 34 | - {:metric => CompoundMetricTest.sc_hash, | ||
| 35 | - :code => 'sc', :weight => 1.0, :aggregation_form => 'AVERAGE'} | ||
| 36 | - end | 5 | +class MetricConfigurationTest < ActiveSupport::TestCase |
| 37 | 6 | ||
| 38 | def setup | 7 | def setup |
| 39 | - @hash = self.class.amloc_configuration_hash | ||
| 40 | - @range = self.class.amloc_configuration | 8 | + @hash = MetricConfigurationFixtures.amloc_configuration_hash |
| 9 | + @range = MetricConfigurationFixtures.amloc_configuration | ||
| 41 | end | 10 | end |
| 42 | 11 | ||
| 43 | should 'create metric configuration from hash' do | 12 | should 'create metric configuration from hash' do |