From bcd6ba1814b7a077884abcf253042233fdbbdc3e Mon Sep 17 00:00:00 2001 From: Eduardo Silva Araújo Date: Fri, 8 Apr 2016 14:18:26 -0300 Subject: [PATCH] Add FUNCTION scope to compound_metric_configuration form --- app/helpers/compound_metric_configurations_helper.rb | 4 +++- config/locales/views/metric_configurations/en.yml | 1 + config/locales/views/metric_configurations/pt.yml | 1 + spec/helpers/compound_metric_configurations_helper_spec.rb | 4 +++- 4 files changed, 8 insertions(+), 2 deletions(-) diff --git a/app/helpers/compound_metric_configurations_helper.rb b/app/helpers/compound_metric_configurations_helper.rb index 21cb31d..e139618 100644 --- a/app/helpers/compound_metric_configurations_helper.rb +++ b/app/helpers/compound_metric_configurations_helper.rb @@ -1,6 +1,8 @@ module CompoundMetricConfigurationsHelper def scope_options - [[t("scopes.METHOD"),"METHOD"], [t("scopes.CLASS"), "CLASS"], [t("scopes.PACKAGE"), "PACKAGE"], [t("scopes.SOFTWARE"), "SOFTWARE"]] + %w(FUNCTION METHOD CLASS PACKAGE SOFTWARE).map do |scope| + [t("scopes.#{scope}"), scope] + end end def compound_metric_human_name(count=1) diff --git a/config/locales/views/metric_configurations/en.yml b/config/locales/views/metric_configurations/en.yml index 683bd25..7411bc5 100644 --- a/config/locales/views/metric_configurations/en.yml +++ b/config/locales/views/metric_configurations/en.yml @@ -40,6 +40,7 @@ en: invalid_metric_or_collector: "Invalid combination of metric collector, name/code and type" invalid_model: "Invalid %{model}" scopes: + FUNCTION: "Function" METHOD: "Method" CLASS: "Class" PACKAGE: "Package" diff --git a/config/locales/views/metric_configurations/pt.yml b/config/locales/views/metric_configurations/pt.yml index db0b68d..b0ae42e 100644 --- a/config/locales/views/metric_configurations/pt.yml +++ b/config/locales/views/metric_configurations/pt.yml @@ -44,6 +44,7 @@ pt: invalid_metric_or_collector: "Combinação inválida de coletor de métricas, nome/código e tipo" invalid_model: "%{model} inválido" scopes: + FUNCTION: "Função" METHOD: "Método" CLASS: "Classe" PACKAGE: "Pacote" diff --git a/spec/helpers/compound_metric_configurations_helper_spec.rb b/spec/helpers/compound_metric_configurations_helper_spec.rb index 2763a3a..a0cea82 100644 --- a/spec/helpers/compound_metric_configurations_helper_spec.rb +++ b/spec/helpers/compound_metric_configurations_helper_spec.rb @@ -3,7 +3,9 @@ require 'rails_helper' describe CompoundMetricConfigurationsHelper, :type => :helper do describe 'scope_options' do it 'should return an array with the supported scope options' do - expect(helper.scope_options).to eq [["Method","METHOD"], ["Class", "CLASS"], ["Package", "PACKAGE"], ["Software", "SOFTWARE"]] + expect(helper.scope_options).to eq [ + ["Function", "FUNCTION"], ["Method","METHOD"], ["Class", "CLASS"], ["Package", "PACKAGE"], ["Software", "SOFTWARE"] + ] end end -- libgit2 0.21.2