Commit 360ddc34cf250d42da24652d8f3db7a5e193b18b
Committed by
Rafael Manzo
1 parent
99e7e985
Exists in
colab
and in
4 other branches
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>
Showing
10 changed files
with
31 additions
and
26 deletions
Show diff stats
app/controllers/compound_metric_configurations_controller.rb
... | ... | @@ -25,7 +25,7 @@ class CompoundMetricConfigurationsController < BaseMetricConfigurationsControlle |
25 | 25 | respond_to do |format| |
26 | 26 | edit |
27 | 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 | 29 | format.json { head :no_content } |
30 | 30 | else |
31 | 31 | failed_action(format, 'edit') |
... | ... | @@ -59,7 +59,7 @@ class CompoundMetricConfigurationsController < BaseMetricConfigurationsControlle |
59 | 59 | #Code extracted from create action |
60 | 60 | def create_and_redir(format) |
61 | 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 | 63 | else |
64 | 64 | failed_action(format, 'new') |
65 | 65 | end | ... | ... |
app/views/compound_metric_configurations/_form.html.erb
... | ... | @@ -8,7 +8,7 @@ |
8 | 8 | |
9 | 9 | <div class="form-row"> |
10 | 10 | <div class="field-container"> |
11 | - <%= f.label t('weight'), class: 'control-label' %> | |
11 | + <%= f.label :weight, t('weight'), class: 'control-label' %> | |
12 | 12 | <%= f.text_field :weight, :required => true, class: 'text-field form-control' %> |
13 | 13 | </div> |
14 | 14 | <div class="help-container"> | ... | ... |
app/views/compound_metric_configurations/_metric_options.html.erb
1 | 1 | <div class="form-row"> |
2 | 2 | <div class="field-container"> |
3 | - <%= f.label t('name'), class: 'control-label' %> | |
3 | + <%= f.label :name, t('name'), class: 'control-label' %> | |
4 | 4 | <%= f.text_field :name, :required => true, class: 'text-field form-control', value: (metric.name unless metric.nil?) %> |
5 | 5 | </div> |
6 | 6 | <div class="help-container"> |
... | ... | @@ -12,7 +12,7 @@ |
12 | 12 | |
13 | 13 | <div class="form-row"> |
14 | 14 | <div class="field-container"> |
15 | - <%= f.label t('description'), class: 'control-label' %> | |
15 | + <%= f.label :description, t('description'), class: 'control-label' %> | |
16 | 16 | <%= f.text_field :description, class: 'text-field form-control', value: (metric.description unless metric.nil?) %> |
17 | 17 | </div> |
18 | 18 | <div class="help-container"> |
... | ... | @@ -24,7 +24,7 @@ |
24 | 24 | |
25 | 25 | <div class="form-row"> |
26 | 26 | <div class="field-container"> |
27 | - <%= f.label t('script'), class: 'control-label' %> | |
27 | + <%= f.label :script, t('script'), class: 'control-label' %> | |
28 | 28 | <%= f.text_area :script, :required => true, class: 'text-area form-control', value: (metric.script unless metric.nil?) %> |
29 | 29 | </div> |
30 | 30 | <div class="help-container"> |
... | ... | @@ -36,7 +36,7 @@ |
36 | 36 | |
37 | 37 | <div class="form-row"> |
38 | 38 | <div class="field-container"> |
39 | - <%= f.label t('scope'), class: 'control-label' %> | |
39 | + <%= f.label :scope, t('scope'), class: 'control-label' %> | |
40 | 40 | <%= f.select( :scope, scope_options, {class: 'form-control', selected: (metric.scope unless metric.nil?)} ) %> |
41 | 41 | </div> |
42 | 42 | <div class="help-container"> |
... | ... | @@ -48,7 +48,7 @@ |
48 | 48 | |
49 | 49 | <div class="form-row"> |
50 | 50 | <div class="field-container"> |
51 | - <%= f.label t('code'), class: 'control-label' %> | |
51 | + <%= f.label :code, t('code'), class: 'control-label' %> | |
52 | 52 | <%= f.text_field :code, :required => true, class: 'text-field form-control' %> |
53 | 53 | </div> |
54 | 54 | <div class="help-container"> | ... | ... |
config/application.rb
... | ... | @@ -17,8 +17,7 @@ module Mezuro |
17 | 17 | # config.time_zone = 'Central Time (US & Canada)' |
18 | 18 | |
19 | 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 | 21 | # config.i18n.default_locale = :de |
23 | 22 | config.i18n.enforce_available_locales = true |
24 | 23 | ... | ... |
config/locales/views/en.yml
... | ... | @@ -58,20 +58,20 @@ en: |
58 | 58 | metric: "Metric" |
59 | 59 | value: "Value" |
60 | 60 | threshold: "Threshold" |
61 | - granularity: "Granularity:" | |
61 | + granularity: "Granularity" | |
62 | 62 | repositories: "Repositories" |
63 | 63 | type: "Type" |
64 | 64 | address: "Address" |
65 | - script: "Script" | |
65 | + script: "script" | |
66 | 66 | add_range: "Add Range" |
67 | 67 | back: "Back" |
68 | 68 | destroy: "Destroy" |
69 | 69 | save: "Save" |
70 | 70 | color: "Color" |
71 | 71 | a: "A" |
72 | - state: "State:" | |
73 | - license: "License:" | |
74 | - periodicity: "Periodicity:" | |
72 | + state: "State" | |
73 | + license: "License" | |
74 | + periodicity: "Periodicity" | |
75 | 75 | reprocess: "Reprocess" |
76 | 76 | tutorial: "Tutorial" |
77 | 77 | requisites: "Requisites" |
... | ... | @@ -331,3 +331,6 @@ en: |
331 | 331 | password_confirmation: "Password confirmation" |
332 | 332 | current_password: "Current password" |
333 | 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 | 69 | save: "Salvar" |
70 | 70 | color: "Cor" |
71 | 71 | a: "A" |
72 | - state: "Estado:" | |
72 | + state: "Estado" | |
73 | 73 | license: "Licença" |
74 | - periodicity: "Periodicidade:" | |
74 | + periodicity: "Periodicidade" | |
75 | 75 | reprocess: "Reprocessar" |
76 | 76 | tutorial: "Tutorial" |
77 | 77 | requisites: "Requisitos" |
... | ... | @@ -326,6 +326,9 @@ pt: |
326 | 326 | password_confirmation: "Confirme sua senha" |
327 | 327 | current_password: "Senha Atual" |
328 | 328 | modules: "Módulos" |
329 | + comments: "Comentários" | |
330 | + aggregation_form: "Forma de Agregação" | |
331 | + kalibro_configuration: "Configuração" | |
329 | 332 | |
330 | 333 | #errors |
331 | 334 | errors: | ... | ... |
features/compound_metric_configuration/edition.feature
... | ... | @@ -28,7 +28,7 @@ Feature: Compound Metric Configuration edition |
28 | 28 | And I fill the Code field with "Another_code" |
29 | 29 | And I press the Save button |
30 | 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 | 33 | @kalibro_configuration_restart@javascript |
34 | 34 | Scenario: trying to edit with blank fields | ... | ... |
features/repository/create.feature
... | ... | @@ -16,7 +16,7 @@ Scenario: repository creation |
16 | 16 | And I set the select field "Type" as "GIT" |
17 | 17 | And I fill the Address field with "https://github.com/mezuro/kalibro_gem.git" |
18 | 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 | 20 | When I press the Save button |
21 | 21 | Then I should see the saved repository's content |
22 | 22 | |
... | ... | @@ -32,7 +32,7 @@ Scenario: repository creation blank validations |
32 | 32 | And I set the select field "License" as "ISC License (ISC)" |
33 | 33 | And I set the select field "Type" as "GIT" |
34 | 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 | 36 | When I press the Save button |
37 | 37 | Then I should see "Name can't be blank" |
38 | 38 | And I should see "Address can't be blank" |
... | ... | @@ -51,7 +51,7 @@ Scenario: repository creation with name already taken |
51 | 51 | And I set the select field "Type" as "GIT" |
52 | 52 | And I fill the Address field with "https://github.com/mezuro/kalibro_gem.git" |
53 | 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 | 55 | When I press the Save button |
56 | 56 | Then I should see "Name should be unique within project" |
57 | 57 | |
... | ... | @@ -68,6 +68,6 @@ Scenario: Repository name with whitespaces |
68 | 68 | And I set the select field "Type" as "GIT" |
69 | 69 | And I fill the Address field with "https://github.com/mezuro/kalibro_gem.git" |
70 | 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 | 72 | When I press the Save button |
73 | 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's name$/) do |
92 | 92 | end |
93 | 93 | |
94 | 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 | 96 | end |
97 | 97 | |
98 | 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 | 7 | end |
8 | 8 | |
9 | 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 | 11 | end |
12 | 12 | |
13 | 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 | 15 | end |
16 | 16 | |
17 | 17 | Then(/^my name should have changed to (.+)$/) do |text| |
... | ... | @@ -30,4 +30,4 @@ end |
30 | 30 | When(/^I click the "(.*?)" icon$/) do |icon| |
31 | 31 | find('#' + icon).click # the hashtag symbol is necessary to find the id of a HTML element |
32 | 32 | sleep(1) #This sleep is essential to make the popup visible when we take a picture of the page |
33 | -end | |
34 | 33 | \ No newline at end of file |
34 | +end | ... | ... |