Commit acc5122c81b5ca8ac57794a309d0fad57e8d4a73
Committed by
Paulo Meireles
1 parent
f0de97a9
Exists in
master
and in
23 other branches
[Mezuro] ModuleNodeFixtures
Showing
4 changed files
with
40 additions
and
31 deletions
Show diff stats
| ... | ... | @@ -0,0 +1,30 @@ |
| 1 | +class ModuleNodeFixtures | |
| 2 | + | |
| 3 | + def self.qt_calculator_tree | |
| 4 | + node = Kalibro::Entities::ModuleNode.new | |
| 5 | + node.module = ModuleFixtures.qt_calculator | |
| 6 | + node.children = [new_node('Dialog', 'CLASS'), new_node('main', 'CLASS')] | |
| 7 | + node | |
| 8 | + end | |
| 9 | + | |
| 10 | + def self.qt_calculator_tree_hash | |
| 11 | + {:module => ModuleFixtures.qt_calculator_hash, | |
| 12 | + :child => [ | |
| 13 | + {:module => {:name => 'Dialog', :granularity => 'CLASS'}}, | |
| 14 | + {:module => {:name => 'main', :granularity => 'CLASS'}} | |
| 15 | + ] | |
| 16 | + } | |
| 17 | + end | |
| 18 | + | |
| 19 | + private | |
| 20 | + | |
| 21 | + def self.new_node(name, granularity) | |
| 22 | + the_module = Kalibro::Entities::Module.new | |
| 23 | + the_module.name = name | |
| 24 | + the_module.granularity = granularity | |
| 25 | + node = Kalibro::Entities::ModuleNode.new | |
| 26 | + node.module = the_module | |
| 27 | + node | |
| 28 | + end | |
| 29 | + | |
| 30 | +end | ... | ... |
plugins/mezuro/test/unit/kalibro/entities/metric_configuration_test.rb
| ... | ... | @@ -18,8 +18,10 @@ class MetricConfigurationTest < ActiveSupport::TestCase |
| 18 | 18 | end |
| 19 | 19 | |
| 20 | 20 | should 'create appropriate metric type' do |
| 21 | - assert self.class.amloc_configuration.metric.instance_of?(Kalibro::Entities::NativeMetric) | |
| 22 | - assert self.class.sc_configuration.metric.instance_of?(Kalibro::Entities::CompoundMetric) | |
| 21 | + amloc = MetricConfigurationFixtures.amloc_configuration | |
| 22 | + sc = MetricConfigurationFixtures.sc_configuration | |
| 23 | + assert amloc.metric.instance_of?(Kalibro::Entities::NativeMetric) | |
| 24 | + assert sc.metric.instance_of?(Kalibro::Entities::CompoundMetric) | |
| 23 | 25 | end |
| 24 | 26 | |
| 25 | 27 | end | ... | ... |
plugins/mezuro/test/unit/kalibro/entities/metric_result_test.rb
| ... | ... | @@ -18,8 +18,8 @@ class MetricResultTest < ActiveSupport::TestCase |
| 18 | 18 | end |
| 19 | 19 | |
| 20 | 20 | should 'create appropriate metric type' do |
| 21 | - assert self.class.amloc_result.metric.instance_of?(Kalibro::Entities::NativeMetric) | |
| 22 | - assert self.class.sc_result.metric.instance_of?(Kalibro::Entities::CompoundMetric) | |
| 21 | + assert MetricResultFixtures.amloc_result.metric.instance_of?(Kalibro::Entities::NativeMetric) | |
| 22 | + assert MetricResultFixtures.sc_result.metric.instance_of?(Kalibro::Entities::CompoundMetric) | |
| 23 | 23 | end |
| 24 | 24 | |
| 25 | 25 | should 'convert single descendent result to array' do | ... | ... |
plugins/mezuro/test/unit/kalibro/entities/module_node_test.rb
| 1 | 1 | require "test_helper" |
| 2 | 2 | |
| 3 | -class ModuleNodeTest < ActiveSupport::TestCase | |
| 4 | - | |
| 5 | - def self.qt_calculator_tree | |
| 6 | - node = Kalibro::Entities::ModuleNode.new | |
| 7 | - node.module = ModuleTest.qt_calculator | |
| 8 | - node.children = [new_node('Dialog', 'CLASS'), new_node('main', 'CLASS')] | |
| 9 | - node | |
| 10 | - end | |
| 3 | +require "#{RAILS_ROOT}/plugins/mezuro/test/fixtures/module_node_fixtures" | |
| 11 | 4 | |
| 12 | - def self.new_node(name, granularity) | |
| 13 | - the_module = Kalibro::Entities::Module.new | |
| 14 | - the_module.name = name | |
| 15 | - the_module.granularity = granularity | |
| 16 | - node = Kalibro::Entities::ModuleNode.new | |
| 17 | - node.module = the_module | |
| 18 | - node | |
| 19 | - end | |
| 20 | - | |
| 21 | - def self.qt_calculator_tree_hash | |
| 22 | - {:module => ModuleTest.qt_calculator_hash, | |
| 23 | - :child => [ | |
| 24 | - {:module => {:name => 'Dialog', :granularity => 'CLASS'}}, | |
| 25 | - {:module => {:name => 'main', :granularity => 'CLASS'}} | |
| 26 | - ] | |
| 27 | - } | |
| 28 | - end | |
| 5 | +class ModuleNodeTest < ActiveSupport::TestCase | |
| 29 | 6 | |
| 30 | 7 | def setup |
| 31 | - @hash = self.class.qt_calculator_tree_hash | |
| 32 | - @node = self.class.qt_calculator_tree | |
| 8 | + @hash = ModuleNodeFixtures.qt_calculator_tree_hash | |
| 9 | + @node = ModuleNodeFixtures.qt_calculator_tree | |
| 33 | 10 | end |
| 34 | 11 | |
| 35 | 12 | should 'create module node from hash' do | ... | ... |