Commit b73ab20877e1b831f7c67bfb4bbca504e8a5b098
Committed by
Paulo Meireles
1 parent
83456776
Exists in
master
and in
23 other branches
[Mezuro] MetricResultFixtures
Showing
3 changed files
with
34 additions
and
29 deletions
Show diff stats
| ... | ... | @@ -0,0 +1,29 @@ |
| 1 | +class MetricResultFixtures | |
| 2 | + | |
| 3 | + def self.amloc_result | |
| 4 | + result = Kalibro::Entities::MetricResult.new | |
| 5 | + result.metric = NativeMetricFixtures.amloc | |
| 6 | + result.value = 0.0 | |
| 7 | + result.descendent_results = [40.0, 42.0] | |
| 8 | + result.range = RangeFixtures.amloc_excellent | |
| 9 | + result | |
| 10 | + end | |
| 11 | + | |
| 12 | + def self.sc_result | |
| 13 | + result = Kalibro::Entities::MetricResult.new | |
| 14 | + result.metric = CompoundMetricFixtures.sc | |
| 15 | + result.value = 1.0 | |
| 16 | + result.descendent_results = [2.0, 42.0] | |
| 17 | + result | |
| 18 | + end | |
| 19 | + | |
| 20 | + def self.amloc_result_hash | |
| 21 | + {:metric => NativeMetricFixtures.amloc_hash, :value => 0.0, :descendent_result => [40.0, 42.0], | |
| 22 | + :range => RangeFixtures.amloc_excellent_hash} | |
| 23 | + end | |
| 24 | + | |
| 25 | + def self.sc_result_hash | |
| 26 | + {:metric => CompoundMetricFixtures.sc_hash, :value => 1.0, :descendent_result => [2.0, 42.0]} | |
| 27 | + end | |
| 28 | + | |
| 29 | +end | ... | ... |
plugins/mezuro/test/unit/kalibro/entities/metric_result_test.rb
| 1 | 1 | require "test_helper" |
| 2 | -class MetricResultTest < ActiveSupport::TestCase | |
| 3 | - | |
| 4 | - def self.amloc_result | |
| 5 | - result = Kalibro::Entities::MetricResult.new | |
| 6 | - result.metric = NativeMetricTest.amloc | |
| 7 | - result.value = 0.0 | |
| 8 | - result.descendent_results = [40.0, 42.0] | |
| 9 | - result.range = RangeTest.amloc_excellent | |
| 10 | - result | |
| 11 | - end | |
| 12 | - | |
| 13 | - def self.sc_result | |
| 14 | - result = Kalibro::Entities::MetricResult.new | |
| 15 | - result.metric = CompoundMetricTest.sc | |
| 16 | - result.value = 1.0 | |
| 17 | - result.descendent_results = [2.0, 42.0] | |
| 18 | - result | |
| 19 | - end | |
| 20 | 2 | |
| 21 | - def self.amloc_result_hash | |
| 22 | - {:metric => NativeMetricTest.amloc_hash, | |
| 23 | - :value => 0.0, :descendent_result => [40.0, 42.0], | |
| 24 | - :range => RangeTest.amloc_excellent_hash} | |
| 25 | - end | |
| 3 | +require "#{RAILS_ROOT}/plugins/mezuro/test/fixtures/metric_result_fixtures" | |
| 26 | 4 | |
| 27 | - def self.sc_result_hash | |
| 28 | - {:metric => CompoundMetricTest.sc_hash, | |
| 29 | - :value => 1.0, :descendent_result => [2.0, 42.0]} | |
| 30 | - end | |
| 5 | +class MetricResultTest < ActiveSupport::TestCase | |
| 31 | 6 | |
| 32 | 7 | def setup |
| 33 | - @hash = self.class.amloc_result_hash | |
| 34 | - @result = self.class.amloc_result | |
| 8 | + @hash = MetricResultFixtures.amloc_result_hash | |
| 9 | + @result = MetricResultFixtures.amloc_result | |
| 35 | 10 | end |
| 36 | 11 | |
| 37 | 12 | should 'create metric result from hash' do | ... | ... |