Commit 148950b6f60841eca4997959b573d64f744c6108
Committed by
Paulo Meireles
1 parent
a574d0cd
Exists in
master
and in
28 other branches
[Mezuro] RangeFixtures
Showing
2 changed files
with
37 additions
and
33 deletions
Show diff stats
| @@ -0,0 +1,33 @@ | @@ -0,0 +1,33 @@ | ||
| 1 | +class RangeFixtures | ||
| 2 | + | ||
| 3 | + Infinity = 1.0/0.0 | ||
| 4 | + | ||
| 5 | + def self.amloc_excellent | ||
| 6 | + range = Kalibro::Entities::Range.new | ||
| 7 | + range.beginning = 0.0 | ||
| 8 | + range.end = 7.0 | ||
| 9 | + range.label = 'Excellent' | ||
| 10 | + range.grade = 10.0 | ||
| 11 | + range.color = 'ff00ff00' | ||
| 12 | + range | ||
| 13 | + end | ||
| 14 | + | ||
| 15 | + def self.amloc_bad | ||
| 16 | + range = Kalibro::Entities::Range.new | ||
| 17 | + range.beginning = 19.5 | ||
| 18 | + range.end = Infinity | ||
| 19 | + range.label = 'Bad' | ||
| 20 | + range.grade = 0.0 | ||
| 21 | + range.color = 'ffff0000' | ||
| 22 | + range | ||
| 23 | + end | ||
| 24 | + | ||
| 25 | + def self.amloc_excellent_hash | ||
| 26 | + {:beginning => 0.0, :end => 7.0, :label => 'Excellent', :grade => 10.0, :color => 'ff00ff00'} | ||
| 27 | + end | ||
| 28 | + | ||
| 29 | + def self.amloc_bad_hash | ||
| 30 | + {:beginning => 19.5, :end => Infinity, :label => 'Bad',:grade => 0.0, :color => 'ffff0000'} | ||
| 31 | + end | ||
| 32 | + | ||
| 33 | +end |
plugins/mezuro/test/unit/kalibro/entities/range_test.rb
| 1 | require "test_helper" | 1 | require "test_helper" |
| 2 | -class RangeTest < ActiveSupport::TestCase | ||
| 3 | - | ||
| 4 | - Infinity = 1.0/0.0 | ||
| 5 | 2 | ||
| 6 | - def self.amloc_excellent | ||
| 7 | - range = Kalibro::Entities::Range.new | ||
| 8 | - range.beginning = 0.0 | ||
| 9 | - range.end = 7.0 | ||
| 10 | - range.label = 'Excellent' | ||
| 11 | - range.grade = 10.0 | ||
| 12 | - range.color = 'ff00ff00' | ||
| 13 | - range | ||
| 14 | - end | ||
| 15 | - | ||
| 16 | - def self.amloc_bad | ||
| 17 | - range = Kalibro::Entities::Range.new | ||
| 18 | - range.beginning = 19.5 | ||
| 19 | - range.end = Infinity | ||
| 20 | - range.label = 'Bad' | ||
| 21 | - range.grade = 0.0 | ||
| 22 | - range.color = 'ffff0000' | ||
| 23 | - range | ||
| 24 | - end | 3 | +require "#{RAILS_ROOT}/plugins/mezuro/test/fixtures/range_fixtures" |
| 25 | 4 | ||
| 26 | - def self.amloc_excellent_hash | ||
| 27 | - {:beginning => 0.0, :end => 7.0, :label => 'Excellent', | ||
| 28 | - :grade => 10.0, :color => 'ff00ff00'} | ||
| 29 | - end | ||
| 30 | - | ||
| 31 | - def self.amloc_bad_hash | ||
| 32 | - {:beginning => 19.5, :end => Infinity, :label => 'Bad', | ||
| 33 | - :grade => 0.0, :color => 'ffff0000'} | ||
| 34 | - end | 5 | +class RangeTest < ActiveSupport::TestCase |
| 35 | 6 | ||
| 36 | def setup | 7 | def setup |
| 37 | - @hash = self.class.amloc_bad_hash | ||
| 38 | - @range = self.class.amloc_bad | 8 | + @hash = RangeFixtures.amloc_bad_hash |
| 9 | + @range = RangeFixtures.amloc_bad | ||
| 39 | end | 10 | end |
| 40 | 11 | ||
| 41 | should 'create range from hash' do | 12 | should 'create range from hash' do |