Commit bd6b0bc9e139df5432eaaa29544130aef8710940

Authored by Diego Camarinha
1 parent 046080d1

Use ruby native metrics instead of analizo metrics

  * Creates a step to create a ruby configuration with the Saikuro
    metric
  * Define new factories for a saikuro metric and saikuro metric
    configuration
features/repository/notify_push.feature
@@ -22,7 +22,8 @@ Feature: Notify push to repository @@ -22,7 +22,8 @@ Feature: Notify push to repository
22 @kalibro_configuration_restart @kalibro_processor_restart 22 @kalibro_configuration_restart @kalibro_processor_restart
23 Scenario: Repository with an errored processing 23 Scenario: Repository with an errored processing
24 Given I am a regular user 24 Given I am a regular user
25 - And I have a sample configuration with native metrics 25 + And I have a sample reading group
  26 + And I have a sample configuration with the Saikuro native metric
26 And I have a compound metric configuration with script "rtrnaqdfwqefwqr213r2145211234ed a = b=2" within the given mezuro configuration 27 And I have a compound metric configuration with script "rtrnaqdfwqefwqr213r2145211234ed a = b=2" within the given mezuro configuration
27 And I have a sample repository 28 And I have a sample repository
28 And I start to process that repository 29 And I start to process that repository
features/step_definitions/repository_steps.rb
@@ -119,6 +119,17 @@ Given(/^I am at the All Repositories page$/) do @@ -119,6 +119,17 @@ Given(/^I am at the All Repositories page$/) do
119 visit repositories_path 119 visit repositories_path
120 end 120 end
121 121
  122 +Given(/^I have a sample configuration with the (\w+) native metric$/) do |metric|
  123 + metric_configuration_factory = (metric + "_metric_configuration").downcase
  124 + metric_factory = metric.downcase
  125 + @kalibro_configuration = FactoryGirl.create(:ruby_configuration)
  126 + metric_configuration = FactoryGirl.create(metric_configuration_factory.to_sym,
  127 + {id: 4,
  128 + metric: FactoryGirl.build(metric_factory.to_sym),
  129 + reading_group_id: @reading_group.id,
  130 + kalibro_configuration_id: @kalibro_configuration.id})
  131 +end
  132 +
122 When(/^I click on the sample metric's name$/) do 133 When(/^I click on the sample metric's name$/) do
123 find_link(@metric_results.first.metric_configuration.metric.name).trigger('click') 134 find_link(@metric_results.first.metric_configuration.metric.name).trigger('click')
124 end 135 end
spec/factories/kalibro_configurations.rb
@@ -20,5 +20,10 @@ FactoryGirl.define do @@ -20,5 +20,10 @@ FactoryGirl.define do
20 name "Public Kalibro Configuration" 20 name "Public Kalibro Configuration"
21 description "Public Configuration." 21 description "Public Configuration."
22 end 22 end
  23 +
  24 + factory :ruby_configuration do
  25 + name "Ruby"
  26 + description "Code metrics for Ruby."
  27 + end
23 end 28 end
24 end 29 end
spec/factories/metric_configurations.rb
@@ -39,4 +39,10 @@ FactoryGirl.define do @@ -39,4 +39,10 @@ FactoryGirl.define do
39 metric { FactoryGirl.build(:hotspot_metric) } 39 metric { FactoryGirl.build(:hotspot_metric) }
40 kalibro_configuration_id 1 40 kalibro_configuration_id 1
41 end 41 end
  42 +
  43 + factory :saikuro_metric_configuration, class: MetricConfiguration do
  44 + metric { FactoryGirl.build(:saikuro) }
  45 + weight 1
  46 + aggregation_form "MEAN"
  47 + end
42 end 48 end