Commit 9c55fa8cac8aa480e96aa3a46347c41d0eeb0fc9
Committed by
João M. M. da Silva
1 parent
8940677b
Exists in
master
and in
29 other branches
[Mezuro] Completed range snapshot model, fixture and tests refactoring.
Showing
4 changed files
with
36 additions
and
19 deletions
Show diff stats
plugins/mezuro/test/fixtures/native_metric_fixtures.rb
@@ -1,19 +0,0 @@ | @@ -1,19 +0,0 @@ | ||
1 | -class NativeMetricFixtures | ||
2 | - | ||
3 | - def self.total_cof | ||
4 | - Kalibro::NativeMetric.new total_cof_hash | ||
5 | - end | ||
6 | - | ||
7 | - def self.total_cof_hash | ||
8 | - {:name => 'Total Coupling Factor', :scope => 'APPLICATION', :origin => 'Analizo', :language => ['JAVA']} | ||
9 | - end | ||
10 | - | ||
11 | - def self.amloc | ||
12 | - Kalibro::NativeMetric.new amloc_hash | ||
13 | - end | ||
14 | - | ||
15 | - def self.amloc_hash | ||
16 | - {:name => 'Average Method LOC', :scope => 'CLASS', :origin => 'Analizo', :language => ['JAVA']} | ||
17 | - end | ||
18 | - | ||
19 | -end |
@@ -0,0 +1,11 @@ | @@ -0,0 +1,11 @@ | ||
1 | +class RangeSnapshotFixtures | ||
2 | + | ||
3 | + def self.range_snapshot | ||
4 | + Kalibro::RangeSnapshot.new range_snapshot_hash | ||
5 | + end | ||
6 | + | ||
7 | + def self.range_snapshot_hash | ||
8 | + { :end => 5, :label => "snapshot", :grade => 10, :color => "FF2284", :comments => "comment" } | ||
9 | + end | ||
10 | + | ||
11 | +end |
@@ -0,0 +1,20 @@ | @@ -0,0 +1,20 @@ | ||
1 | +require "test_helper" | ||
2 | + | ||
3 | +require "#{RAILS_ROOT}/plugins/mezuro/test/fixtures/range_snapshot_fixtures" | ||
4 | + | ||
5 | +class RangeSnapshotTest < ActiveSupport::TestCase | ||
6 | + | ||
7 | + def setup | ||
8 | + @hash = RangeSnapshotFixtures.range_snapshot_hash | ||
9 | + @range_snapshot = RangeSnapshotFixtures.range_snapshot | ||
10 | + end | ||
11 | + | ||
12 | + should 'create range_snapshot from hash' do | ||
13 | + assert_equal @hash[:comments], Kalibro::RangeSnapshot.new(@hash).comments | ||
14 | + end | ||
15 | + | ||
16 | + should 'convert range_snapshot to hash' do | ||
17 | + assert_equal @hash, @range_snapshot.to_hash | ||
18 | + end | ||
19 | + | ||
20 | +end |