Commit 360ddc34cf250d42da24652d8f3db7a5e193b18b

Authored by Heitor
Committed by Rafael Manzo
1 parent 99e7e985

Fixing compound metric configuration acceptance tests

Also changing the other accpetance tests to include the new translations
Signed off by: Diego Araújo <diegoamc90@gmail.com>
app/controllers/compound_metric_configurations_controller.rb
@@ -25,7 +25,7 @@ class CompoundMetricConfigurationsController &lt; BaseMetricConfigurationsControlle @@ -25,7 +25,7 @@ class CompoundMetricConfigurationsController &lt; BaseMetricConfigurationsControlle
25 respond_to do |format| 25 respond_to do |format|
26 edit 26 edit
27 if @compound_metric_configuration.update(metric_configuration_params) 27 if @compound_metric_configuration.update(metric_configuration_params)
28 - format.html { redirect_to kalibro_configuration_path(@compound_metric_configuration.kalibro_configuration_id), notice: t('successfully_updated', :record => t('compound') + @compound_metric_configuration.class.model_name.human) } 28 + format.html { redirect_to kalibro_configuration_path(@compound_metric_configuration.kalibro_configuration_id), notice: t('successfully_updated', :record => t('compound') + " " + @compound_metric_configuration.class.model_name.human) }
29 format.json { head :no_content } 29 format.json { head :no_content }
30 else 30 else
31 failed_action(format, 'edit') 31 failed_action(format, 'edit')
@@ -59,7 +59,7 @@ class CompoundMetricConfigurationsController &lt; BaseMetricConfigurationsControlle @@ -59,7 +59,7 @@ class CompoundMetricConfigurationsController &lt; BaseMetricConfigurationsControlle
59 #Code extracted from create action 59 #Code extracted from create action
60 def create_and_redir(format) 60 def create_and_redir(format)
61 if @compound_metric_configuration.save 61 if @compound_metric_configuration.save
62 - format.html { redirect_to kalibro_configuration_path(@compound_metric_configuration.kalibro_configuration_id), notice: t('successfully_created', :record => t('compound') + @compound_metric_configuration.class.model_name.human) } 62 + format.html { redirect_to kalibro_configuration_path(@compound_metric_configuration.kalibro_configuration_id), notice: t('successfully_created', :record => t('compound') + " " + @compound_metric_configuration.class.model_name.human) }
63 else 63 else
64 failed_action(format, 'new') 64 failed_action(format, 'new')
65 end 65 end
app/views/compound_metric_configurations/_form.html.erb
@@ -8,7 +8,7 @@ @@ -8,7 +8,7 @@
8 8
9 <div class="form-row"> 9 <div class="form-row">
10 <div class="field-container"> 10 <div class="field-container">
11 - <%= f.label t('weight'), class: 'control-label' %> 11 + <%= f.label :weight, t('weight'), class: 'control-label' %>
12 <%= f.text_field :weight, :required => true, class: 'text-field form-control' %> 12 <%= f.text_field :weight, :required => true, class: 'text-field form-control' %>
13 </div> 13 </div>
14 <div class="help-container"> 14 <div class="help-container">
app/views/compound_metric_configurations/_metric_options.html.erb
1 <div class="form-row"> 1 <div class="form-row">
2 <div class="field-container"> 2 <div class="field-container">
3 - <%= f.label t('name'), class: 'control-label' %> 3 + <%= f.label :name, t('name'), class: 'control-label' %>
4 <%= f.text_field :name, :required => true, class: 'text-field form-control', value: (metric.name unless metric.nil?) %> 4 <%= f.text_field :name, :required => true, class: 'text-field form-control', value: (metric.name unless metric.nil?) %>
5 </div> 5 </div>
6 <div class="help-container"> 6 <div class="help-container">
@@ -12,7 +12,7 @@ @@ -12,7 +12,7 @@
12 12
13 <div class="form-row"> 13 <div class="form-row">
14 <div class="field-container"> 14 <div class="field-container">
15 - <%= f.label t('description'), class: 'control-label' %> 15 + <%= f.label :description, t('description'), class: 'control-label' %>
16 <%= f.text_field :description, class: 'text-field form-control', value: (metric.description unless metric.nil?) %> 16 <%= f.text_field :description, class: 'text-field form-control', value: (metric.description unless metric.nil?) %>
17 </div> 17 </div>
18 <div class="help-container"> 18 <div class="help-container">
@@ -24,7 +24,7 @@ @@ -24,7 +24,7 @@
24 24
25 <div class="form-row"> 25 <div class="form-row">
26 <div class="field-container"> 26 <div class="field-container">
27 - <%= f.label t('script'), class: 'control-label' %> 27 + <%= f.label :script, t('script'), class: 'control-label' %>
28 <%= f.text_area :script, :required => true, class: 'text-area form-control', value: (metric.script unless metric.nil?) %> 28 <%= f.text_area :script, :required => true, class: 'text-area form-control', value: (metric.script unless metric.nil?) %>
29 </div> 29 </div>
30 <div class="help-container"> 30 <div class="help-container">
@@ -36,7 +36,7 @@ @@ -36,7 +36,7 @@
36 36
37 <div class="form-row"> 37 <div class="form-row">
38 <div class="field-container"> 38 <div class="field-container">
39 - <%= f.label t('scope'), class: 'control-label' %> 39 + <%= f.label :scope, t('scope'), class: 'control-label' %>
40 <%= f.select( :scope, scope_options, {class: 'form-control', selected: (metric.scope unless metric.nil?)} ) %> 40 <%= f.select( :scope, scope_options, {class: 'form-control', selected: (metric.scope unless metric.nil?)} ) %>
41 </div> 41 </div>
42 <div class="help-container"> 42 <div class="help-container">
@@ -48,7 +48,7 @@ @@ -48,7 +48,7 @@
48 48
49 <div class="form-row"> 49 <div class="form-row">
50 <div class="field-container"> 50 <div class="field-container">
51 - <%= f.label t('code'), class: 'control-label' %> 51 + <%= f.label :code, t('code'), class: 'control-label' %>
52 <%= f.text_field :code, :required => true, class: 'text-field form-control' %> 52 <%= f.text_field :code, :required => true, class: 'text-field form-control' %>
53 </div> 53 </div>
54 <div class="help-container"> 54 <div class="help-container">
config/application.rb
@@ -17,8 +17,7 @@ module Mezuro @@ -17,8 +17,7 @@ module Mezuro
17 # config.time_zone = 'Central Time (US & Canada)' 17 # config.time_zone = 'Central Time (US & Canada)'
18 18
19 # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded. 19 # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
20 - config.i18n.load_path += Dir[Rails.root.join('config', 'locales/views', '*.{rb,yml}').to_s]  
21 - config.i18n.load_path += Dir[Rails.root.join('config', 'locales/controllers', '*.{rb,yml}').to_s] 20 + config.i18n.load_path += Dir[Rails.root.join('config', 'locales/*', '*.{rb,yml}').to_s]
22 # config.i18n.default_locale = :de 21 # config.i18n.default_locale = :de
23 config.i18n.enforce_available_locales = true 22 config.i18n.enforce_available_locales = true
24 23
config/locales/views/en.yml
@@ -58,20 +58,20 @@ en: @@ -58,20 +58,20 @@ en:
58 metric: "Metric" 58 metric: "Metric"
59 value: "Value" 59 value: "Value"
60 threshold: "Threshold" 60 threshold: "Threshold"
61 - granularity: "Granularity:" 61 + granularity: "Granularity"
62 repositories: "Repositories" 62 repositories: "Repositories"
63 type: "Type" 63 type: "Type"
64 address: "Address" 64 address: "Address"
65 - script: "Script" 65 + script: "script"
66 add_range: "Add Range" 66 add_range: "Add Range"
67 back: "Back" 67 back: "Back"
68 destroy: "Destroy" 68 destroy: "Destroy"
69 save: "Save" 69 save: "Save"
70 color: "Color" 70 color: "Color"
71 a: "A" 71 a: "A"
72 - state: "State:"  
73 - license: "License:"  
74 - periodicity: "Periodicity:" 72 + state: "State"
  73 + license: "License"
  74 + periodicity: "Periodicity"
75 reprocess: "Reprocess" 75 reprocess: "Reprocess"
76 tutorial: "Tutorial" 76 tutorial: "Tutorial"
77 requisites: "Requisites" 77 requisites: "Requisites"
@@ -331,3 +331,6 @@ en: @@ -331,3 +331,6 @@ en:
331 password_confirmation: "Password confirmation" 331 password_confirmation: "Password confirmation"
332 current_password: "Current password" 332 current_password: "Current password"
333 modules: "Modules" 333 modules: "Modules"
  334 + comments: "Comments"
  335 + aggregation_form: "Aggregation Form"
  336 + kalibro_configuration: "Configuration"
config/locales/views/pt.yml
@@ -69,9 +69,9 @@ pt: @@ -69,9 +69,9 @@ pt:
69 save: "Salvar" 69 save: "Salvar"
70 color: "Cor" 70 color: "Cor"
71 a: "A" 71 a: "A"
72 - state: "Estado:" 72 + state: "Estado"
73 license: "Licença" 73 license: "Licença"
74 - periodicity: "Periodicidade:" 74 + periodicity: "Periodicidade"
75 reprocess: "Reprocessar" 75 reprocess: "Reprocessar"
76 tutorial: "Tutorial" 76 tutorial: "Tutorial"
77 requisites: "Requisitos" 77 requisites: "Requisitos"
@@ -326,6 +326,9 @@ pt: @@ -326,6 +326,9 @@ pt:
326 password_confirmation: "Confirme sua senha" 326 password_confirmation: "Confirme sua senha"
327 current_password: "Senha Atual" 327 current_password: "Senha Atual"
328 modules: "Módulos" 328 modules: "Módulos"
  329 + comments: "Comentários"
  330 + aggregation_form: "Forma de Agregação"
  331 + kalibro_configuration: "Configuração"
329 332
330 #errors 333 #errors
331 errors: 334 errors:
features/compound_metric_configuration/edition.feature
@@ -28,7 +28,7 @@ Feature: Compound Metric Configuration edition @@ -28,7 +28,7 @@ Feature: Compound Metric Configuration edition
28 And I fill the Code field with "Another_code" 28 And I fill the Code field with "Another_code"
29 And I press the Save button 29 And I press the Save button
30 Then I should see "Another_code" 30 Then I should see "Another_code"
31 - And I should see "Compound Metric Configuration was successfully updated." 31 + And I should see "Compound Metric configuration was successfully updated."
32 32
33 @kalibro_configuration_restart@javascript 33 @kalibro_configuration_restart@javascript
34 Scenario: trying to edit with blank fields 34 Scenario: trying to edit with blank fields
features/repository/create.feature
@@ -16,7 +16,7 @@ Scenario: repository creation @@ -16,7 +16,7 @@ Scenario: repository creation
16 And I set the select field "Type" as "GIT" 16 And I set the select field "Type" as "GIT"
17 And I fill the Address field with "https://github.com/mezuro/kalibro_gem.git" 17 And I fill the Address field with "https://github.com/mezuro/kalibro_gem.git"
18 And I set the select field "Process Period" as "1 day" 18 And I set the select field "Process Period" as "1 day"
19 - And I set the select field "repository_kalibro_configuration_id" as "Java" 19 + And I set the select field "Kalibro Configuration" as "Java"
20 When I press the Save button 20 When I press the Save button
21 Then I should see the saved repository's content 21 Then I should see the saved repository's content
22 22
@@ -32,7 +32,7 @@ Scenario: repository creation blank validations @@ -32,7 +32,7 @@ Scenario: repository creation blank validations
32 And I set the select field "License" as "ISC License (ISC)" 32 And I set the select field "License" as "ISC License (ISC)"
33 And I set the select field "Type" as "GIT" 33 And I set the select field "Type" as "GIT"
34 And I set the select field "Process Period" as "1 day" 34 And I set the select field "Process Period" as "1 day"
35 - And I set the select field "repository_kalibro_configuration_id" as "Java" 35 + And I set the select field "Kalibro Configuration" as "Java"
36 When I press the Save button 36 When I press the Save button
37 Then I should see "Name can't be blank" 37 Then I should see "Name can't be blank"
38 And I should see "Address can't be blank" 38 And I should see "Address can't be blank"
@@ -51,7 +51,7 @@ Scenario: repository creation with name already taken @@ -51,7 +51,7 @@ Scenario: repository creation with name already taken
51 And I set the select field "Type" as "GIT" 51 And I set the select field "Type" as "GIT"
52 And I fill the Address field with "https://github.com/mezuro/kalibro_gem.git" 52 And I fill the Address field with "https://github.com/mezuro/kalibro_gem.git"
53 And I set the select field "Process Period" as "1 day" 53 And I set the select field "Process Period" as "1 day"
54 - And I set the select field "repository_kalibro_configuration_id" as "Java" 54 + And I set the select field "Kalibro Configuration" as "Java"
55 When I press the Save button 55 When I press the Save button
56 Then I should see "Name should be unique within project" 56 Then I should see "Name should be unique within project"
57 57
@@ -68,6 +68,6 @@ Scenario: Repository name with whitespaces @@ -68,6 +68,6 @@ Scenario: Repository name with whitespaces
68 And I set the select field "Type" as "GIT" 68 And I set the select field "Type" as "GIT"
69 And I fill the Address field with "https://github.com/mezuro/kalibro_gem.git" 69 And I fill the Address field with "https://github.com/mezuro/kalibro_gem.git"
70 And I set the select field "Process Period" as "1 day" 70 And I set the select field "Process Period" as "1 day"
71 - And I set the select field "repository_kalibro_configuration_id" as "Java" 71 + And I set the select field "Kalibro Configuration" as "Java"
72 When I press the Save button 72 When I press the Save button
73 Then I should see "Name should be unique within project" 73 Then I should see "Name should be unique within project"
features/step_definitions/repository_steps.rb
@@ -92,7 +92,7 @@ When(/^I click on the sample metric&#39;s name$/) do @@ -92,7 +92,7 @@ When(/^I click on the sample metric&#39;s name$/) do
92 end 92 end
93 93
94 When(/^I set the select field "(.+)" as "(.+)"$/) do |field, text| 94 When(/^I set the select field "(.+)" as "(.+)"$/) do |field, text|
95 - select text, from: field 95 + select text, from: I18n.t(field.gsub(" ", "_").downcase)
96 end 96 end
97 97
98 When(/^I visit the repository show page$/) do 98 When(/^I visit the repository show page$/) do
features/step_definitions/user_steps.rb
@@ -7,11 +7,11 @@ When(/^I press the (.+) button$/) do |text| @@ -7,11 +7,11 @@ When(/^I press the (.+) button$/) do |text|
7 end 7 end
8 8
9 When(/^I fill the (.+) field with "(.+)"$/) do |field, text| 9 When(/^I fill the (.+) field with "(.+)"$/) do |field, text|
10 - fill_in field, :with => text 10 + fill_in I18n.t(field.gsub(" ", "_").downcase), :with => text
11 end 11 end
12 12
13 Then(/^the field "(.*?)" should be filled with "(.*?)"$/) do |field, value| 13 Then(/^the field "(.*?)" should be filled with "(.*?)"$/) do |field, value|
14 - expect(page.find_field(field).value).to eq(value) 14 + expect(page.find_field(I18n.t(field.gsub(" ", "_").downcase)).value).to eq(value)
15 end 15 end
16 16
17 Then(/^my name should have changed to (.+)$/) do |text| 17 Then(/^my name should have changed to (.+)$/) do |text|
@@ -30,4 +30,4 @@ end @@ -30,4 +30,4 @@ end
30 When(/^I click the "(.*?)" icon$/) do |icon| 30 When(/^I click the "(.*?)" icon$/) do |icon|
31 find('#' + icon).click # the hashtag symbol is necessary to find the id of a HTML element 31 find('#' + icon).click # the hashtag symbol is necessary to find the id of a HTML element
32 sleep(1) #This sleep is essential to make the popup visible when we take a picture of the page 32 sleep(1) #This sleep is essential to make the popup visible when we take a picture of the page
33 -end  
34 \ No newline at end of file 33 \ No newline at end of file
  34 +end