Commit 83456776a3f565e61bde001db27a5e5ec8e6cb40
Committed by
Paulo Meireles
1 parent
0943326b
Exists in
master
and in
29 other branches
[Mezuro] ConfigurationFixtures
Showing
2 changed files
with
24 additions
and
19 deletions
Show diff stats
@@ -0,0 +1,20 @@ | @@ -0,0 +1,20 @@ | ||
1 | +class ConfigurationFixtures | ||
2 | + | ||
3 | + def self.kalibro_configuration | ||
4 | + configuration = Kalibro::Entities::Configuration.new | ||
5 | + configuration.name = 'Kalibro for Java' | ||
6 | + configuration.description = 'Kalibro configuration for Java projects.' | ||
7 | + configuration.metric_configurations = [ | ||
8 | + MetricConfigurationFixtures.amloc_configuration, | ||
9 | + MetricConfigurationFixtures.sc_configuration] | ||
10 | + configuration | ||
11 | + end | ||
12 | + | ||
13 | + def self.kalibro_configuration_hash | ||
14 | + {:name => 'Kalibro for Java', :description => 'Kalibro configuration for Java projects.', | ||
15 | + :metric_configuration => [ | ||
16 | + MetricConfigurationFixtures.amloc_configuration_hash, | ||
17 | + MetricConfigurationFixtures.sc_configuration_hash]} | ||
18 | + end | ||
19 | + | ||
20 | +end |
plugins/mezuro/test/unit/kalibro/entities/configuration_test.rb
1 | require "test_helper" | 1 | require "test_helper" |
2 | -class ConfigurationTest < ActiveSupport::TestCase | ||
3 | 2 | ||
4 | - def self.kalibro_configuration | ||
5 | - amloc_configuration = MetricConfigurationTest.amloc_configuration | ||
6 | - sc_configuration = MetricConfigurationTest.sc_configuration | ||
7 | - configuration = Kalibro::Entities::Configuration.new | ||
8 | - configuration.name = 'Kalibro for Java' | ||
9 | - configuration.description = 'Kalibro configuration for Java projects.' | ||
10 | - configuration.metric_configurations = [amloc_configuration, sc_configuration] | ||
11 | - configuration | ||
12 | - end | 3 | +require "#{RAILS_ROOT}/plugins/mezuro/test/fixtures/configuration_fixtures" |
13 | 4 | ||
14 | - def self.kalibro_configuration_hash | ||
15 | - amloc_hash = MetricConfigurationTest.amloc_configuration_hash | ||
16 | - sc_hash = MetricConfigurationTest.sc_configuration_hash | ||
17 | - {:name => 'Kalibro for Java', | ||
18 | - :description => 'Kalibro configuration for Java projects.', | ||
19 | - :metric_configuration => [amloc_hash, sc_hash]} | ||
20 | - end | 5 | +class ConfigurationTest < ActiveSupport::TestCase |
21 | 6 | ||
22 | def setup | 7 | def setup |
23 | - @hash = self.class.kalibro_configuration_hash | ||
24 | - @configuration = self.class.kalibro_configuration | 8 | + @hash = ConfigurationFixtures.kalibro_configuration_hash |
9 | + @configuration = ConfigurationFixtures.kalibro_configuration | ||
25 | end | 10 | end |
26 | 11 | ||
27 | should 'create configuration from hash' do | 12 | should 'create configuration from hash' do |