Commit c68cbbbcaee3cf75c8a99d8dd1bc99daadf32e7f

Authored by Rafael Reggiani Manzo
2 parents 5faff891 f1535e69

Merge pull request #313 from mezuro/aggregation_form_fix

Aggregation form fix
.travis.yml
... ... @@ -9,7 +9,7 @@ before_script:
9 9 - pushd kalibro_install
10 10 # Remove bugged libzmq3 package, see https://github.com/travis-ci/travis-ci/issues/982 and https://github.com/travis-ci/travis-ci/issues/1715 for details
11 11 - sudo apt-get remove libzmq3
12   - - export KALIBRO_PROCESSOR_VERSION=v1.1.7.rc1
  12 + - export KALIBRO_PROCESSOR_VERSION=v1.1.7
13 13 - export KALIBRO_CONFIGURATIONS_VERSION=v2.0.0
14 14 - bash install.sh
15 15 - popd
... ...
app/helpers/metric_configurations_helper.rb
1 1 module MetricConfigurationsHelper
2 2 def aggregation_options
3   - [[t("aggregation_forms.AVERAGE"),"AVERAGE"], [t("aggregation_forms.MEDIAN"), "MEDIAN"], [t("aggregation_forms.MAXIMUM"), "MAXIMUM"], [t("aggregation_forms.MINIMUM"), "MINIMUM"], [t("aggregation_forms.STANDARD_DEVIATION"), "STANDARD_DEVIATION"], [t("aggregation_forms.COUNT"), "COUNT"]]
  3 + [[t("aggregation_forms.MEAN"),"MEAN"], [t("aggregation_forms.MEDIAN"), "MEDIAN"], [t("aggregation_forms.MAXIMUM"), "MAXIMUM"], [t("aggregation_forms.MINIMUM"), "MINIMUM"], [t("aggregation_forms.STANDARD_DEVIATION"), "STANDARD_DEVIATION"], [t("aggregation_forms.COUNT"), "COUNT"]]
4 4 end
5 5  
6 6 def reading_group_options
... ...
config/locales/views/metric_configurations/en.yml
... ... @@ -45,10 +45,9 @@ en:
45 45 PACKAGE: "Package"
46 46 SOFTWARE: "Software"
47 47 aggregation_forms:
48   - AVERAGE: "Average"
  48 + MEAN: "Mean"
49 49 MEDIAN: "Median"
50 50 MAXIMUM: "Maximum"
51 51 MINIMUM: "Minimum"
52 52 COUNT: "Count"
53 53 STANDARD_DEVIATION: "Standard Deviation"
54   -
... ...
config/locales/views/metric_configurations/pt.yml
... ... @@ -49,7 +49,7 @@ pt:
49 49 PACKAGE: "Pacote"
50 50 SOFTWARE: "Software"
51 51 aggregation_forms:
52   - AVERAGE: "Média"
  52 + MEAN: "Média"
53 53 MEDIAN: "Mediana"
54 54 MAXIMUM: "Máxima"
55 55 MINIMUM: "Mínima"
... ...
features/golden_path/configure_and_process.feature 0 → 100644
... ... @@ -0,0 +1,31 @@
  1 +Feature: Create a new native configuration and process a repository using it
  2 + In order to view the results of a ruby repository
  3 + As a regular user
  4 + I should be able to configure a set of metrics and process a repository using them
  5 +
  6 + @kalibro_configuration_restart @kalibro_processor_restart @javascript
  7 + Scenario: Create a ruby configuration and process a ruby repository
  8 + Given I am a regular user
  9 + And I am signed in
  10 + And I own a sample configuration
  11 + And I have a reading group named "Scholar"
  12 + And I have a sample repository
  13 + And I am at the Sample Configuration page
  14 + And I click the Add Metric link
  15 + And I click the "MetricFu" h3
  16 + And I click the Pain link
  17 + And I fill the Weight field with "2"
  18 + And I set the select field "Aggregation Form" as "Mean"
  19 + And I set the select field "Reading Group" as "Scholar"
  20 + When I press the Save button
  21 + Then I should see "Pain"
  22 + And I should see "2"
  23 + When I start to process that repository
  24 + And I wait up for a ready processing
  25 + And I ask for the last ready processing of the given repository
  26 + And I ask for the module result of the given processing
  27 + And I ask for the metric results of the given module result
  28 + When I visit the repository show page
  29 + And I click the "Tree Metric Results" h3
  30 + Then I should see the sample metric's name
  31 + And I should see the ruby metric results
... ...
features/repository/show/metric_results.feature
... ... @@ -51,22 +51,6 @@ Feature: Repository metric results
51 51 And I click the "Tree Metric Results" h3
52 52 Then I should see "Repository process returned with error. There are no tree metric results."
53 53  
54   - @kalibro_processor_restart @kalibro_configuration_restart @javascript
55   - Scenario: Should show the metric results after processing with a ruby metric configuration
56   - Given I am a regular user
57   - And I am signed in
58   - And I have a sample configuration with ruby native metrics
59   - And I have a sample repository
60   - And I start to process that repository
61   - And I wait up for a ready processing
62   - And I ask for the last ready processing of the given repository
63   - And I ask for the module result of the given processing
64   - And I ask for the metric results of the given module result
65   - When I visit the repository show page
66   - And I click the "Tree Metric Results" h3
67   - Then I should see the sample metric's name
68   - And I should see the ruby metric results
69   -
70 54 # TODO: Scenario: Should show the graphic of a given metric
71 55 # It was getting really difficult to test this because of Poltergeist's timeouts
72 56 # so we gave up on this for now
... ...
features/step_definitions/repository_steps.rb
... ... @@ -59,6 +59,7 @@ end
59 59  
60 60 Given(/^I wait up for a ready processing$/) do
61 61 while !@repository.has_ready_processing
  62 + expect(@repository.last_processing_state).to_not eq "ERROR"
62 63 sleep(10)
63 64 end
64 65 end
... ...
features/tree_metric_configuration/create.feature
... ... @@ -20,30 +20,13 @@ Feature: Tree Metric Configuration Creation
20 20 And I click the "Analizo" h3
21 21 And I click the Total Lines of Code link
22 22 And I fill the Weight field with "2"
23   - And I set the select field "Aggregation Form" as "Average"
  23 + And I set the select field "Aggregation Form" as "Mean"
24 24 And I set the select field "Reading Group" as "Scholar"
25 25 When I press the Save button
26 26 Then I should see "Total Lines of Code"
27 27 Then I should see "2"
28 28  
29 29 @kalibro_configuration_restart @javascript
30   - Scenario: ruby metric configuration creation
31   - Given I am a regular user
32   - And I am signed in
33   - And I own a sample configuration
34   - And I have a reading group named "Scholar"
35   - And I am at the Sample Configuration page
36   - And I click the Add Metric link
37   - And I click the "MetricFu" h3
38   - And I click the Pain link
39   - And I fill the Weight field with "2"
40   - And I set the select field "Aggregation Form" as "Average"
41   - And I set the select field "Reading Group" as "Scholar"
42   - When I press the Save button
43   - Then I should see "Pain"
44   - Then I should see "2"
45   -
46   - @kalibro_configuration_restart @javascript
47 30 Scenario: metric configuration creation
48 31 Given I am a regular user
49 32 And I am signed in
... ... @@ -68,7 +51,7 @@ Feature: Tree Metric Configuration Creation
68 51 And I click the "Analizo" h3
69 52 And I click the Total Abstract Classes link
70 53 And I fill the Weight field with "2"
71   - And I set the select field "Aggregation Form" as "Average"
  54 + And I set the select field "Aggregation Form" as "Mean"
72 55 And I set the select field "Reading Group" as "Scholar"
73 56 When I press the Save button
74 57 Then I should see "Code must be unique within a kalibro configuration"
... ...
spec/helpers/metric_configurations_helper_spec.rb
... ... @@ -3,7 +3,7 @@ require 'rails_helper'
3 3 describe MetricConfigurationsHelper, :type => :helper do
4 4 describe 'aggregation_form_options' do
5 5 it 'should return an array with the supported aggregation forms' do
6   - expect(helper.aggregation_options).to eq [["Average","AVERAGE"], ["Median", "MEDIAN"], ["Maximum", "MAXIMUM"], ["Minimum", "MINIMUM"],
  6 + expect(helper.aggregation_options).to eq [["Mean","MEAN"], ["Median", "MEDIAN"], ["Maximum", "MAXIMUM"], ["Minimum", "MINIMUM"],
7 7 ["Standard Deviation", "STANDARD_DEVIATION"], ["Count", "COUNT"]]
8 8 end
9 9 end
... ...