diff --git a/plugins/mezuro/lib/kalibro/range_snapshot.rb b/plugins/mezuro/lib/kalibro/range_snapshot.rb new file mode 100644 index 0000000..2b16020 --- /dev/null +++ b/plugins/mezuro/lib/kalibro/range_snapshot.rb @@ -0,0 +1,5 @@ +class Kalibro::RangeSnapshot < Kalibro::Model + + attr_accessor :end, :label, :grade, :color, :comments + +end diff --git a/plugins/mezuro/test/fixtures/native_metric_fixtures.rb b/plugins/mezuro/test/fixtures/native_metric_fixtures.rb deleted file mode 100644 index 809bcc1..0000000 --- a/plugins/mezuro/test/fixtures/native_metric_fixtures.rb +++ /dev/null @@ -1,19 +0,0 @@ -class NativeMetricFixtures - - def self.total_cof - Kalibro::NativeMetric.new total_cof_hash - end - - def self.total_cof_hash - {:name => 'Total Coupling Factor', :scope => 'APPLICATION', :origin => 'Analizo', :language => ['JAVA']} - end - - def self.amloc - Kalibro::NativeMetric.new amloc_hash - end - - def self.amloc_hash - {:name => 'Average Method LOC', :scope => 'CLASS', :origin => 'Analizo', :language => ['JAVA']} - end - -end diff --git a/plugins/mezuro/test/fixtures/range_snapshot_fixtures.rb b/plugins/mezuro/test/fixtures/range_snapshot_fixtures.rb new file mode 100644 index 0000000..76b7ee1 --- /dev/null +++ b/plugins/mezuro/test/fixtures/range_snapshot_fixtures.rb @@ -0,0 +1,11 @@ +class RangeSnapshotFixtures + + def self.range_snapshot + Kalibro::RangeSnapshot.new range_snapshot_hash + end + + def self.range_snapshot_hash + { :end => 5, :label => "snapshot", :grade => 10, :color => "FF2284", :comments => "comment" } + end + +end diff --git a/plugins/mezuro/test/unit/kalibro/range_snapshot_test.rb b/plugins/mezuro/test/unit/kalibro/range_snapshot_test.rb new file mode 100644 index 0000000..09c3ebb --- /dev/null +++ b/plugins/mezuro/test/unit/kalibro/range_snapshot_test.rb @@ -0,0 +1,20 @@ +require "test_helper" + +require "#{RAILS_ROOT}/plugins/mezuro/test/fixtures/range_snapshot_fixtures" + +class RangeSnapshotTest < ActiveSupport::TestCase + + def setup + @hash = RangeSnapshotFixtures.range_snapshot_hash + @range_snapshot = RangeSnapshotFixtures.range_snapshot + end + + should 'create range_snapshot from hash' do + assert_equal @hash[:comments], Kalibro::RangeSnapshot.new(@hash).comments + end + + should 'convert range_snapshot to hash' do + assert_equal @hash, @range_snapshot.to_hash + end + +end -- libgit2 0.21.2