Commit fd1d1b353ac1a476985ed67fae3cece636d84151
1 parent
afd386e0
Exists in
colab
and in
4 other branches
Language can be set by the route
Missing actions for menu selection Signed off by: Daniel Miranda <danielkza@gmail.com>
Showing
23 changed files
with
143 additions
and
92 deletions
Show diff stats
app/controllers/application_controller.rb
... | ... | @@ -19,9 +19,18 @@ class ApplicationController < ActionController::Base |
19 | 19 | end |
20 | 20 | |
21 | 21 | def set_locale |
22 | - compatible_locale = http_accept_language.compatible_language_from(I18n.available_locales) | |
23 | - unless compatible_locale.nil? | |
24 | - I18n.locale = compatible_locale | |
22 | + unless params[:locale].nil? | |
23 | + I18n.locale = params[:locale] | |
24 | + else | |
25 | + compatible_locale = http_accept_language.compatible_language_from(I18n.available_locales) | |
26 | + unless compatible_locale.nil? | |
27 | + I18n.locale = compatible_locale | |
28 | + end | |
25 | 29 | end |
26 | 30 | end |
31 | + | |
32 | + # This happens after the *_url *_path helpers | |
33 | + def default_url_options(options = {}) | |
34 | + { locale: I18n.locale == I18n.default_locale ? nil : I18n.locale }.merge options | |
35 | + end | |
27 | 36 | end | ... | ... |
app/controllers/concerns/ownership_authentication.rb
... | ... | @@ -65,7 +65,7 @@ module OwnershipAuthentication |
65 | 65 | def check_reading_group_ownership(id) |
66 | 66 | if current_user.reading_group_ownerships.find_by_reading_group_id(id).nil? |
67 | 67 | respond_to do |format| |
68 | - format.html { redirect_to reading_group_url(id), notice: "You're not allowed to do this operation" } | |
68 | + format.html { redirect_to reading_group_url(id: id), notice: "You're not allowed to do this operation" } | |
69 | 69 | format.json { head :no_content } |
70 | 70 | end |
71 | 71 | end |
... | ... | @@ -76,7 +76,7 @@ module OwnershipAuthentication |
76 | 76 | def check_kalibro_configuration_ownership(id) |
77 | 77 | if current_user.kalibro_configuration_ownerships.find_by_kalibro_configuration_id(id).nil? |
78 | 78 | respond_to do |format| |
79 | - format.html { redirect_to kalibro_configurations_url(id), notice: "You're not allowed to do this operation" } | |
79 | + format.html { redirect_to kalibro_configurations_url(id: id), notice: "You're not allowed to do this operation" } | |
80 | 80 | format.json { head :no_content } |
81 | 81 | end |
82 | 82 | end | ... | ... |
app/views/layouts/application.html.erb
... | ... | @@ -63,7 +63,7 @@ |
63 | 63 | <li><%= link_to KalibroConfiguration.model_name.human, kalibro_configurations_path %></li> |
64 | 64 | <li><%= link_to ReadingGroup.model_name.human, reading_groups_path %></li> |
65 | 65 | </ul> |
66 | - <ul class="nav navbar-nav" style="float: right;"> | |
66 | + <ul class="nav navbar-nav navbar-right"> | |
67 | 67 | <% if user_signed_in? %> |
68 | 68 | <li><%= link_to t('edit_account'), edit_user_registration_path %></li> |
69 | 69 | <li><%= link_to t('sign_out'), destroy_user_session_path, :method => :delete %></li> |
... | ... | @@ -71,6 +71,17 @@ |
71 | 71 | <li><%= link_to t('sign_in'), new_user_session_path %></li> |
72 | 72 | <li><%= link_to t('sign_up'), new_user_registration_path %></li> |
73 | 73 | <% end %> |
74 | + <li class="dropdown"> | |
75 | + <a class="dropdown-toggle" aria-expanded="true" role="button" data-toggle="dropdown" href="#"> | |
76 | + Languages | |
77 | + <span class="caret"></span> | |
78 | + </a> | |
79 | + <ul class="dropdown-menu" role="menu"> | |
80 | + <% I18n.available_locales.each do |locale| %> | |
81 | + <li><a href="#"><%= locale.to_s %></a></li> | |
82 | + <% end %> | |
83 | + </ul> | |
84 | + </li> | |
74 | 85 | </ul> |
75 | 86 | </div><!--/.nav-collapse --> |
76 | 87 | </div> |
... | ... | @@ -111,6 +122,16 @@ |
111 | 122 | <div class="footer-right"><%= link_to(image_tag('agplv3-88x31.png'), 'http://www.gnu.org/licenses/agpl-3.0-standalone.html') %> <%= link_to image_tag('fork-me.png'), 'https://github.com/mezuro/prezento' %> <%= image_tag 'usp-cloud-nuvem-logo.png' %> <%= link_to image_tag('banner-ccsl.png', height: '40', width: '190'), 'http://ccsl.ime.usp.br/' %></div> |
112 | 123 | </footer> |
113 | 124 | |
125 | + <script type="text/javascript"> | |
126 | + $(function() { | |
127 | + $( "#languages-accordion > div" ).accordion({ | |
128 | + heightStyle: "content", | |
129 | + collapsible: true, | |
130 | + active: false | |
131 | + }); | |
132 | + }); | |
133 | + </script> | |
134 | + | |
114 | 135 | </div> <!-- /container --> |
115 | 136 | |
116 | 137 | </body> | ... | ... |
config/routes.rb
1 | 1 | Rails.application.routes.draw do |
2 | - devise_for :users | |
3 | - get 'users/:user_id/projects' => 'users#projects', as: :user_projects | |
4 | - | |
5 | - resources :projects do | |
6 | - resources :repositories, except: [:update, :index] | |
7 | - get '/repositories/:id/modules/:module_result_id' => 'repositories#show', as: :repository_module | |
8 | - post '/repositories/:id/state' => 'repositories#state', as: :repository_state | |
9 | - post '/repositories/:id/state_with_date' => 'repositories#state_with_date', as: :repository_state_with_date | |
10 | - put '/repositories/:id' => 'repositories#update', as: :repository_update | |
11 | - get '/repositories/:id/process' => 'repositories#process_repository', as: :repository_process | |
12 | - end | |
2 | + scope "(:locale)", locale: /en|pt/ do | |
3 | + devise_for :users | |
4 | + get 'users/:user_id/projects' => 'users#projects', as: :user_projects | |
5 | + | |
6 | + resources :projects do | |
7 | + resources :repositories, except: [:update, :index] | |
8 | + get '/repositories/:id/modules/:module_result_id' => 'repositories#show', as: :repository_module | |
9 | + post '/repositories/:id/state' => 'repositories#state', as: :repository_state | |
10 | + post '/repositories/:id/state_with_date' => 'repositories#state_with_date', as: :repository_state_with_date | |
11 | + put '/repositories/:id' => 'repositories#update', as: :repository_update | |
12 | + get '/repositories/:id/process' => 'repositories#process_repository', as: :repository_process | |
13 | + end | |
13 | 14 | |
14 | - resources :kalibro_configurations do | |
15 | - get '/metric_configurations/choose_metric' => 'metric_configurations#choose_metric', as: :choose_metric | |
16 | - resources :metric_configurations, except: [:update, :new] do | |
17 | - get '/kalibro_ranges/new' => 'kalibro_ranges#new', as: :new_kalibro_range | |
18 | - resources :kalibro_ranges, except: [:update, :new] | |
19 | - put '/kalibro_ranges/:id' => 'kalibro_ranges#update', as: :kalibro_range_update | |
15 | + resources :kalibro_configurations do | |
16 | + get '/metric_configurations/choose_metric' => 'metric_configurations#choose_metric', as: :choose_metric | |
17 | + resources :metric_configurations, except: [:update, :new] do | |
18 | + get '/kalibro_ranges/new' => 'kalibro_ranges#new', as: :new_kalibro_range | |
19 | + resources :kalibro_ranges, except: [:update, :new] | |
20 | + put '/kalibro_ranges/:id' => 'kalibro_ranges#update', as: :kalibro_range_update | |
21 | + end | |
22 | + post '/metric_configurations/new' => 'metric_configurations#new', as: :new_metric_configuration | |
23 | + put '/metric_configurations/:id' => 'metric_configurations#update', as: :metric_configuration_update | |
24 | + | |
25 | + resources :compound_metric_configurations, except: [:destroy, :update] | |
26 | + put '/compound_metric_configurations/:id' => 'compound_metric_configurations#update', as: :compound_metric_configuration_update | |
20 | 27 | end |
21 | - post '/metric_configurations/new' => 'metric_configurations#new', as: :new_metric_configuration | |
22 | - put '/metric_configurations/:id' => 'metric_configurations#update', as: :metric_configuration_update | |
23 | 28 | |
24 | - resources :compound_metric_configurations, except: [:destroy, :update] | |
25 | - put '/compound_metric_configurations/:id' => 'compound_metric_configurations#update', as: :compound_metric_configuration_update | |
26 | - end | |
29 | + resources :reading_groups do | |
30 | + resources :readings, except: [:index, :update, :show] | |
31 | + put '/readings/:id' => 'readings#update', as: :reading_update | |
32 | + end | |
27 | 33 | |
28 | - resources :reading_groups do | |
29 | - resources :readings, except: [:index, :update, :show] | |
30 | - put '/readings/:id' => 'readings#update', as: :reading_update | |
31 | - end | |
34 | + #resources :modules | |
35 | + post '/modules/:id/metric_history' => 'modules#metric_history' | |
36 | + post '/modules/:id/tree' => 'modules#load_module_tree' | |
32 | 37 | |
33 | - #resources :modules | |
34 | - post '/modules/:id/metric_history' => 'modules#metric_history' | |
35 | - post '/modules/:id/tree' => 'modules#load_module_tree' | |
38 | + # Tutorials | |
39 | + get '/tutorials/:name' => 'tutorials#view', as: 'tutorials' | |
36 | 40 | |
37 | - # Tutorials | |
38 | - get '/tutorials/:name' => 'tutorials#view', as: 'tutorials' | |
41 | + root "home#index" | |
42 | + end | |
39 | 43 | |
40 | - root "home#index" | |
44 | + get '/:locale' => 'home#index' | |
41 | 45 | |
42 | 46 | # The priority is based upon order of creation: first created -> highest priority. |
43 | 47 | # See how all your routes lay out with "rake routes". | ... | ... |
features/compound_metric_configuration/create.feature
... | ... | @@ -38,6 +38,7 @@ Feature: Compound Metric Configuration Creation |
38 | 38 | And I have another compound metric configuration with code "Another_Code" within the given mezuro configuration |
39 | 39 | And I am at the Sample Configuration page |
40 | 40 | And I click the Add Metric link |
41 | + And I take a picture of the page | |
41 | 42 | And I click the Compound Metric link |
42 | 43 | When I fill the Name field with "My Compound Metric" |
43 | 44 | And I fill the Description field with "Some description" | ... | ... |
features/homepage.feature
... | ... | @@ -18,4 +18,11 @@ Feature: Homepage |
18 | 18 | And I should see "Sign Out" |
19 | 19 | And I should see "Latest projects" |
20 | 20 | And I should see "Project" |
21 | - And I should see "Your projects" | |
22 | 21 | \ No newline at end of file |
22 | + And I should see "Your projects" | |
23 | + | |
24 | + @wip | |
25 | + Scenario: Language selection | |
26 | + Given I am at the homepage | |
27 | + When I click the Languages link | |
28 | + And I click the pt link | |
29 | + Then I should see "Entendendo Métricas de Código" | |
23 | 30 | \ No newline at end of file | ... | ... |
features/step_definitions/compound_metric_configuration_steps.rb
... | ... | @@ -15,7 +15,7 @@ Given(/^I have another compound metric configuration with code "(.*?)" within th |
15 | 15 | end |
16 | 16 | |
17 | 17 | When(/^I visit the sample compound metric configuration edit page$/) do |
18 | - visit edit_kalibro_configuration_compound_metric_configuration_path(@compound_metric_configuration.kalibro_configuration_id, @compound_metric_configuration.id) | |
18 | + visit edit_kalibro_configuration_compound_metric_configuration_path(kalibro_configuration_id: @compound_metric_configuration.kalibro_configuration_id, id: @compound_metric_configuration.id) | |
19 | 19 | end |
20 | 20 | |
21 | 21 | When(/^I click the edit link of the Coumpound Metric$/) do |
... | ... | @@ -27,7 +27,7 @@ When(/^I click the show link of "(.*?)"$/) do |name| |
27 | 27 | end |
28 | 28 | |
29 | 29 | When(/^I am at the sample compound metric configuration page$/) do |
30 | - visit kalibro_configuration_compound_metric_configuration_path(@compound_metric_configuration.kalibro_configuration_id, @compound_metric_configuration.id) | |
30 | + visit kalibro_configuration_compound_metric_configuration_path(kalibro_configuration_id: @compound_metric_configuration.kalibro_configuration_id, id: @compound_metric_configuration.id) | |
31 | 31 | expect(page).to have_content(@compound_metric_configuration.metric.name) |
32 | 32 | expect(page).to have_content("Ranges") |
33 | 33 | end | ... | ... |
features/step_definitions/kalibro_configuration_steps.rb
... | ... | @@ -20,11 +20,11 @@ Given(/^I own a sample configuration$/) do |
20 | 20 | end |
21 | 21 | |
22 | 22 | Given(/^I am at the Sample Configuration page$/) do |
23 | - visit kalibro_configuration_path(@kalibro_configuration.id) | |
23 | + visit kalibro_configuration_path(id: @kalibro_configuration.id) | |
24 | 24 | end |
25 | 25 | |
26 | 26 | Given(/^I am at the sample configuration edit page$/) do |
27 | - visit edit_kalibro_configuration_path(@kalibro_configuration.id) | |
27 | + visit edit_kalibro_configuration_path(id: @kalibro_configuration.id) | |
28 | 28 | end |
29 | 29 | |
30 | 30 | Given(/^I own a configuration named "(.*?)"$/) do |name| |
... | ... | @@ -33,7 +33,7 @@ Given(/^I own a configuration named "(.*?)"$/) do |name| |
33 | 33 | end |
34 | 34 | |
35 | 35 | When(/^I visit the sample configuration edit page$/) do |
36 | - visit edit_kalibro_configuration_path(@kalibro_configuration.id) | |
36 | + visit edit_kalibro_configuration_path(id: @kalibro_configuration.id) | |
37 | 37 | end |
38 | 38 | |
39 | 39 | Then(/^I should be in the Edit Configuration page$/) do | ... | ... |
features/step_definitions/kalibro_range_steps.rb
... | ... | @@ -9,11 +9,11 @@ Given(/^I have a sample range within the sample compound metric configuration wi |
9 | 9 | end |
10 | 10 | |
11 | 11 | Given(/^I am at the Edit Kalibro Range page$/) do |
12 | - visit edit_kalibro_configuration_metric_configuration_kalibro_range_path(@metric_configuration.kalibro_configuration_id, @metric_configuration.id, @kalibro_range.id) | |
12 | + visit edit_kalibro_configuration_metric_configuration_kalibro_range_path(kalibro_configuration_id: @metric_configuration.kalibro_configuration_id, metric_configuration_id: @metric_configuration.id, id: @kalibro_range.id) | |
13 | 13 | end |
14 | 14 | |
15 | 15 | Given(/^I am at the Edit Kalibro Range page for the compound metric configuration$/) do |
16 | - visit edit_kalibro_configuration_metric_configuration_kalibro_range_path(@compound_metric_configuration.kalibro_configuration_id, @compound_metric_configuration.id, @kalibro_range.id) | |
16 | + visit edit_kalibro_configuration_metric_configuration_kalibro_range_path(kalibro_configuration_id: @compound_metric_configuration.kalibro_configuration_id, metric_configuration_id: @compound_metric_configuration.id, id: @kalibro_range.id) | |
17 | 17 | end |
18 | 18 | |
19 | 19 | Given(/^the select field "(.*?)" is set as "(.*?)"$/) do |field, text| |
... | ... | @@ -31,11 +31,11 @@ Given(/^I have a sample range within the sample compound metric configuration$/) |
31 | 31 | end |
32 | 32 | |
33 | 33 | When(/^I am at the New Range page$/) do |
34 | - visit kalibro_configuration_metric_configuration_new_kalibro_range_path(@metric_configuration.kalibro_configuration_id, @metric_configuration.id) | |
34 | + visit kalibro_configuration_metric_configuration_new_kalibro_range_path(kalibro_configuration_id: @metric_configuration.kalibro_configuration_id, metric_configuration_id: @metric_configuration.id) | |
35 | 35 | end |
36 | 36 | |
37 | 37 | Given(/^I am at the New Range page for the compound metric configuration$/) do |
38 | - visit kalibro_configuration_metric_configuration_new_kalibro_range_path(@compound_metric_configuration.kalibro_configuration_id, @compound_metric_configuration.id) | |
38 | + visit kalibro_configuration_metric_configuration_new_kalibro_range_path(kalibro_configuration_id: @compound_metric_configuration.kalibro_configuration_id, metric_configuration_id: @compound_metric_configuration.id) | |
39 | 39 | end |
40 | 40 | |
41 | 41 | ... | ... |
features/step_definitions/metric_configuration_steps.rb
... | ... | @@ -20,19 +20,19 @@ Given(/^I have a sample configuration with MetricFu metrics$/) do |
20 | 20 | end |
21 | 21 | |
22 | 22 | When(/^I visit the sample metric configuration edit page$/) do |
23 | - visit edit_kalibro_configuration_metric_configuration_path(@metric_configuration.kalibro_configuration_id, @metric_configuration.id) | |
23 | + visit edit_kalibro_configuration_metric_configuration_path(kalibro_configuration_id: @metric_configuration.kalibro_configuration_id, id: @metric_configuration.id) | |
24 | 24 | end |
25 | 25 | |
26 | 26 | When(/^I visit the sample metric configuration page$/) do |
27 | - visit kalibro_configuration_metric_configuration_path(@metric_configuration.kalibro_configuration_id, @metric_configuration.id) | |
27 | + visit kalibro_configuration_metric_configuration_path(kalibro_configuration_id: @metric_configuration.kalibro_configuration_id, id: @metric_configuration.id) | |
28 | 28 | end |
29 | 29 | |
30 | 30 | When(/^I visit the sample metric configuration page$/) do |
31 | - visit edit_kalibro_configuration_path(@kalibro_configuration.id) | |
31 | + visit edit_kalibro_configuration_path(id: @kalibro_configuration.id) | |
32 | 32 | end |
33 | 33 | |
34 | 34 | Then(/^I am at the sample metric configuration page$/) do |
35 | - visit kalibro_configuration_metric_configuration_path(@metric_configuration.kalibro_configuration_id, @metric_configuration.id) | |
35 | + visit kalibro_configuration_metric_configuration_path(kalibro_configuration_id: @metric_configuration.kalibro_configuration_id, id: @metric_configuration.id) | |
36 | 36 | expect(page).to have_content(@metric_configuration.metric.name) |
37 | 37 | expect(page).to have_content("Ranges") |
38 | 38 | end | ... | ... |
features/step_definitions/project_steps.rb
... | ... | @@ -27,15 +27,15 @@ Given(/^I own a project named "(.*?)"$/) do |name| |
27 | 27 | end |
28 | 28 | |
29 | 29 | Given(/^I am at the Sample Project page$/) do |
30 | - visit project_path(@project.id) | |
30 | + visit project_path(id: @project.id) | |
31 | 31 | end |
32 | 32 | |
33 | 33 | Given(/^I am at the sample project edit page$/) do |
34 | - visit edit_project_path(@project.id) | |
34 | + visit edit_project_path(id: @project.id) | |
35 | 35 | end |
36 | 36 | |
37 | 37 | Given(/^I visit the sample project edit page$/) do |
38 | - visit edit_project_path(@project.id) | |
38 | + visit edit_project_path(id: @project.id) | |
39 | 39 | end |
40 | 40 | |
41 | 41 | Given(/^I am at the New Project page$/) do | ... | ... |
features/step_definitions/reading_group_steps.rb
... | ... | @@ -22,11 +22,11 @@ Given(/^I have a sample reading group$/) do |
22 | 22 | end |
23 | 23 | |
24 | 24 | Given(/^I visit the Sample Reading Group page$/) do |
25 | - visit reading_group_path(@reading_group.id) | |
25 | + visit reading_group_path(id: @reading_group.id) | |
26 | 26 | end |
27 | 27 | |
28 | 28 | Given(/^I am at the sample reading group edit page$/) do |
29 | - visit edit_reading_group_path(@reading_group.id) | |
29 | + visit edit_reading_group_path(id: @reading_group.id) | |
30 | 30 | end |
31 | 31 | |
32 | 32 | Given(/^I own a reading group named "(.*?)"$/) do |name| |
... | ... | @@ -35,7 +35,7 @@ Given(/^I own a reading group named "(.*?)"$/) do |name| |
35 | 35 | end |
36 | 36 | |
37 | 37 | When(/^I visit the sample reading group edit page$/) do |
38 | - visit edit_reading_group_path(@reading_group.id) | |
38 | + visit edit_reading_group_path(id: @reading_group.id) | |
39 | 39 | end |
40 | 40 | |
41 | 41 | Then(/^The field "(.*?)" should be filled with the sample reading group "(.*?)"$/) do |field, value| |
... | ... | @@ -57,7 +57,7 @@ Then(/^I should see the information of the sample reading$/) do |
57 | 57 | end |
58 | 58 | |
59 | 59 | Then(/^I should be in the Edit Reading Group page$/) do |
60 | - visit edit_reading_group_path(@reading_group.id) | |
60 | + visit edit_reading_group_path(id: @reading_group.id) | |
61 | 61 | end |
62 | 62 | |
63 | 63 | Then(/^the Sample Reading Group should not be there$/) do | ... | ... |
features/step_definitions/reading_steps.rb
... | ... | @@ -3,11 +3,11 @@ Given(/^I have a sample reading within the sample reading group$/) do |
3 | 3 | end |
4 | 4 | |
5 | 5 | Given(/^I am at the New Reading page$/) do |
6 | - visit new_reading_group_reading_path(@reading_group.id) | |
6 | + visit new_reading_group_reading_path(reading_group_id: @reading_group.id) | |
7 | 7 | end |
8 | 8 | |
9 | 9 | Given(/^I am at the Edit Reading page$/) do |
10 | - visit edit_reading_group_reading_path(@reading_group.id, @reading.id) | |
10 | + visit edit_reading_group_reading_path(reading_group_id: @reading_group.id, id: @reading.id) | |
11 | 11 | end |
12 | 12 | |
13 | 13 | Given(/^I have a sample reading within the sample reading group labeled "(.*?)"$/) do |label| |
... | ... | @@ -23,7 +23,7 @@ When(/^I click on the center of the color picker$/) do |
23 | 23 | end |
24 | 24 | |
25 | 25 | Then(/^I should be at the New Reading page$/) do |
26 | - visit new_reading_group_reading_path(@reading_group.id) | |
26 | + visit new_reading_group_reading_path(reading_group_id: @reading_group.id) | |
27 | 27 | end |
28 | 28 | |
29 | 29 | Then(/^I should see a color picker Canvas$/) do | ... | ... |
features/step_definitions/repository_steps.rb
... | ... | @@ -64,11 +64,11 @@ Given(/^I wait up for a error processing$/) do |
64 | 64 | end |
65 | 65 | |
66 | 66 | Given(/^I am at the New Repository page$/) do |
67 | - visit new_project_repository_path(@project.id) | |
67 | + visit new_project_repository_path(project_id: @project.id) | |
68 | 68 | end |
69 | 69 | |
70 | 70 | Given(/^I am at repository edit page$/) do |
71 | - visit edit_project_repository_path(@repository.project_id, @repository.id) | |
71 | + visit edit_project_repository_path(project_id: @repository.project_id, id: @repository.id) | |
72 | 72 | end |
73 | 73 | |
74 | 74 | Given(/^I ask for the last ready processing of the given repository$/) do |
... | ... | @@ -96,7 +96,7 @@ When(/^I set the select field "(.+)" as "(.+)"$/) do |field, text| |
96 | 96 | end |
97 | 97 | |
98 | 98 | When(/^I visit the repository show page$/) do |
99 | - visit project_repository_path(@project.id, @repository.id) | |
99 | + visit project_repository_path(project_id: @project.id, id: @repository.id) | |
100 | 100 | end |
101 | 101 | |
102 | 102 | When(/^I click on the sample child's name$/) do | ... | ... |
spec/controllers/base_metric_configurations_controller_spec.rb
... | ... | @@ -80,7 +80,7 @@ describe InheritsFromBaseMetricConfigurationsController, :type => :controller do |
80 | 80 | get :new, kalibro_configuration_id: kalibro_configuration.id |
81 | 81 | end |
82 | 82 | |
83 | - it { is_expected.to redirect_to(kalibro_configurations_url(kalibro_configuration.id)) } | |
83 | + it { is_expected.to redirect_to(kalibro_configurations_url(id: kalibro_configuration.id)) } | |
84 | 84 | it { is_expected.to respond_with(:redirect) } |
85 | 85 | end |
86 | 86 | end | ... | ... |
spec/controllers/compound_metric_configurations_controller_spec.rb
... | ... | @@ -25,7 +25,7 @@ describe CompoundMetricConfigurationsController, :type => :controller do |
25 | 25 | get :new, kalibro_configuration_id: kalibro_configuration.id |
26 | 26 | end |
27 | 27 | |
28 | - it { is_expected.to redirect_to(kalibro_configurations_url(kalibro_configuration.id)) } | |
28 | + it { is_expected.to redirect_to(kalibro_configurations_url(id: kalibro_configuration.id)) } | |
29 | 29 | it { is_expected.to respond_with(:redirect) } |
30 | 30 | end |
31 | 31 | end |
... | ... | @@ -107,7 +107,7 @@ describe CompoundMetricConfigurationsController, :type => :controller do |
107 | 107 | get :edit, id: compound_metric_configuration.id, kalibro_configuration_id: compound_metric_configuration.kalibro_configuration_id.to_s |
108 | 108 | end |
109 | 109 | |
110 | - it { is_expected.to redirect_to(kalibro_configurations_path(kalibro_configuration.id)) } | |
110 | + it { is_expected.to redirect_to(kalibro_configurations_path(id: kalibro_configuration.id)) } | |
111 | 111 | it { is_expected.to respond_with(:redirect) } |
112 | 112 | it { is_expected.to set_flash[:notice].to("You're not allowed to do this operation") } |
113 | 113 | end |
... | ... | @@ -144,7 +144,7 @@ describe CompoundMetricConfigurationsController, :type => :controller do |
144 | 144 | post :update, kalibro_configuration_id: compound_metric_configuration.kalibro_configuration_id, id: compound_metric_configuration.id, metric_configuration: metric_configuration_params |
145 | 145 | end |
146 | 146 | |
147 | - it { should redirect_to(kalibro_configuration_path(compound_metric_configuration.kalibro_configuration_id)) } | |
147 | + it { should redirect_to(kalibro_configuration_path(id: compound_metric_configuration.kalibro_configuration_id)) } | |
148 | 148 | it { should respond_with(:redirect) } |
149 | 149 | end |
150 | 150 | |
... | ... | @@ -166,7 +166,7 @@ describe CompoundMetricConfigurationsController, :type => :controller do |
166 | 166 | post :update, kalibro_configuration_id: compound_metric_configuration.kalibro_configuration_id, id: compound_metric_configuration.id, metric_configuration: metric_configuration_params |
167 | 167 | end |
168 | 168 | |
169 | - it { should redirect_to kalibro_configurations_path(compound_metric_configuration.kalibro_configuration_id) } | |
169 | + it { should redirect_to kalibro_configurations_path(id: compound_metric_configuration.kalibro_configuration_id) } | |
170 | 170 | end |
171 | 171 | end |
172 | 172 | end | ... | ... |
spec/controllers/home_controller_spec.rb
spec/controllers/kalibro_configurations_controller_spec.rb
... | ... | @@ -31,7 +31,7 @@ describe KalibroConfigurationsController, :type => :controller do |
31 | 31 | end |
32 | 32 | |
33 | 33 | it 'should redirect to the show view' do |
34 | - expect(response).to redirect_to kalibro_configuration_path(kalibro_configuration.id) | |
34 | + expect(response).to redirect_to kalibro_configuration_path(id: kalibro_configuration.id) | |
35 | 35 | end |
36 | 36 | end |
37 | 37 | |
... | ... | @@ -119,7 +119,7 @@ describe KalibroConfigurationsController, :type => :controller do |
119 | 119 | delete :destroy, :id => @subject.id |
120 | 120 | end |
121 | 121 | |
122 | - it { is_expected.to redirect_to(kalibro_configurations_path(@subject.id)) } | |
122 | + it { is_expected.to redirect_to(kalibro_configurations_path(id: @subject.id)) } | |
123 | 123 | end |
124 | 124 | end |
125 | 125 | |
... | ... | @@ -181,7 +181,7 @@ describe KalibroConfigurationsController, :type => :controller do |
181 | 181 | get :edit, :id => @subject.id |
182 | 182 | end |
183 | 183 | |
184 | - it { is_expected.to redirect_to(kalibro_configurations_path(@subject.id)) } | |
184 | + it { is_expected.to redirect_to(kalibro_configurations_path(id: @subject.id)) } | |
185 | 185 | it { is_expected.to set_flash[:notice].to("You're not allowed to do this operation") } |
186 | 186 | end |
187 | 187 | end |
... | ... | @@ -225,7 +225,7 @@ describe KalibroConfigurationsController, :type => :controller do |
225 | 225 | end |
226 | 226 | |
227 | 227 | it 'should redirect to the show view' do |
228 | - expect(response).to redirect_to kalibro_configuration_path(kalibro_configuration.id) | |
228 | + expect(response).to redirect_to kalibro_configuration_path(id: kalibro_configuration.id) | |
229 | 229 | end |
230 | 230 | end |
231 | 231 | |
... | ... | @@ -255,7 +255,7 @@ describe KalibroConfigurationsController, :type => :controller do |
255 | 255 | post :update, :id => kalibro_configuration.id, :kalibro_configuration => kalibro_configuration_params |
256 | 256 | end |
257 | 257 | |
258 | - it { is_expected.to redirect_to kalibro_configurations_path(kalibro_configuration.id) } | |
258 | + it { is_expected.to redirect_to kalibro_configurations_path(id: kalibro_configuration.id) } | |
259 | 259 | end |
260 | 260 | end |
261 | 261 | ... | ... |
spec/controllers/kalibro_ranges_controller_spec.rb
... | ... | @@ -28,7 +28,7 @@ describe KalibroRangesController, :type => :controller do |
28 | 28 | get :new, kalibro_configuration_id: kalibro_configuration.id, metric_configuration_id: kalibro_range.metric_configuration_id |
29 | 29 | end |
30 | 30 | |
31 | - it { is_expected.to redirect_to(kalibro_configurations_path(kalibro_configuration.id)) } | |
31 | + it { is_expected.to redirect_to(kalibro_configurations_path(id: kalibro_configuration.id)) } | |
32 | 32 | it { is_expected.to respond_with(:redirect) } |
33 | 33 | end |
34 | 34 | end |
... | ... | @@ -54,7 +54,7 @@ describe KalibroRangesController, :type => :controller do |
54 | 54 | post :create, kalibro_configuration_id: kalibro_configuration.id, metric_configuration_id: kalibro_range.metric_configuration_id, kalibro_range: kalibro_range_params |
55 | 55 | end |
56 | 56 | |
57 | - it { is_expected.to redirect_to(kalibro_configuration_metric_configuration_path(metric_configuration.kalibro_configuration_id, metric_configuration.id)) } | |
57 | + it { is_expected.to redirect_to(kalibro_configuration_metric_configuration_path(kalibro_configuration_id: metric_configuration.kalibro_configuration_id, id: metric_configuration.id)) } | |
58 | 58 | it { is_expected.to respond_with(:redirect) } |
59 | 59 | end |
60 | 60 | |
... | ... | @@ -69,7 +69,7 @@ describe KalibroRangesController, :type => :controller do |
69 | 69 | post :create, kalibro_configuration_id: kalibro_configuration.id, metric_configuration_id: new_kalibro_range.metric_configuration_id, kalibro_range: new_kalibro_range.to_hash |
70 | 70 | end |
71 | 71 | |
72 | - it { is_expected.to redirect_to(kalibro_configuration_compound_metric_configuration_path(compound_metric_configuration.kalibro_configuration_id, compound_metric_configuration.id)) } | |
72 | + it { is_expected.to redirect_to(kalibro_configuration_compound_metric_configuration_path(kalibro_configuration_id: compound_metric_configuration.kalibro_configuration_id, id: compound_metric_configuration.id)) } | |
73 | 73 | it { is_expected.to respond_with(:redirect) } |
74 | 74 | end |
75 | 75 | |
... | ... | @@ -103,7 +103,7 @@ describe KalibroRangesController, :type => :controller do |
103 | 103 | delete :destroy, id: kalibro_range.id, metric_configuration_id: metric_configuration.id, kalibro_configuration_id: metric_configuration.kalibro_configuration_id |
104 | 104 | end |
105 | 105 | |
106 | - it { is_expected.to redirect_to(kalibro_configuration_metric_configuration_path(metric_configuration.kalibro_configuration_id, metric_configuration.id)) } | |
106 | + it { is_expected.to redirect_to(kalibro_configuration_metric_configuration_path(kalibro_configuration_id: metric_configuration.kalibro_configuration_id, id: metric_configuration.id)) } | |
107 | 107 | it { is_expected.to respond_with(:redirect) } |
108 | 108 | end |
109 | 109 | |
... | ... | @@ -120,7 +120,7 @@ describe KalibroRangesController, :type => :controller do |
120 | 120 | delete :destroy, id: new_kalibro_range.id, metric_configuration_id: compound_metric_configuration.id, kalibro_configuration_id: compound_metric_configuration.kalibro_configuration_id |
121 | 121 | end |
122 | 122 | |
123 | - it { is_expected.to redirect_to(kalibro_configuration_compound_metric_configuration_path(compound_metric_configuration.kalibro_configuration_id, compound_metric_configuration.id)) } | |
123 | + it { is_expected.to redirect_to(kalibro_configuration_compound_metric_configuration_path(kalibro_configuration_id: compound_metric_configuration.kalibro_configuration_id, id: compound_metric_configuration.id)) } | |
124 | 124 | it { is_expected.to respond_with(:redirect) } |
125 | 125 | end |
126 | 126 | |
... | ... | @@ -129,7 +129,7 @@ describe KalibroRangesController, :type => :controller do |
129 | 129 | delete :destroy, id: kalibro_range.id, metric_configuration_id: metric_configuration.id, kalibro_configuration_id: metric_configuration.kalibro_configuration_id |
130 | 130 | end |
131 | 131 | |
132 | - it { is_expected.to redirect_to(kalibro_configurations_path(metric_configuration.kalibro_configuration_id)) } | |
132 | + it { is_expected.to redirect_to(kalibro_configurations_path(id: metric_configuration.kalibro_configuration_id)) } | |
133 | 133 | it { is_expected.to respond_with(:redirect) } |
134 | 134 | end |
135 | 135 | end |
... | ... | @@ -172,7 +172,7 @@ describe KalibroRangesController, :type => :controller do |
172 | 172 | get :edit, id: kalibro_range.id, kalibro_configuration_id: metric_configuration.kalibro_configuration_id, metric_configuration_id: metric_configuration.id |
173 | 173 | end |
174 | 174 | |
175 | - it { is_expected.to redirect_to(kalibro_configurations_url(metric_configuration.kalibro_configuration_id)) } | |
175 | + it { is_expected.to redirect_to(kalibro_configurations_url(id: metric_configuration.kalibro_configuration_id)) } | |
176 | 176 | it { is_expected.to respond_with(:redirect) } |
177 | 177 | it { is_expected.to set_flash[:notice].to("You're not allowed to do this operation") } |
178 | 178 | end |
... | ... | @@ -212,7 +212,7 @@ describe KalibroRangesController, :type => :controller do |
212 | 212 | post :update, kalibro_configuration_id: metric_configuration.kalibro_configuration_id, id: kalibro_range.id, metric_configuration_id: metric_configuration.id, kalibro_range: kalibro_range_params |
213 | 213 | end |
214 | 214 | |
215 | - it { is_expected.to redirect_to(kalibro_configuration_metric_configuration_path(metric_configuration.kalibro_configuration_id, metric_configuration.id)) } | |
215 | + it { is_expected.to redirect_to(kalibro_configuration_metric_configuration_path(kalibro_configuration_id: metric_configuration.kalibro_configuration_id, id: metric_configuration.id)) } | |
216 | 216 | it { is_expected.to respond_with(:redirect) } |
217 | 217 | end |
218 | 218 | |
... | ... | @@ -228,7 +228,7 @@ describe KalibroRangesController, :type => :controller do |
228 | 228 | post :update, kalibro_configuration_id: compound_metric_configuration.kalibro_configuration_id, id: new_kalibro_range.id, metric_configuration_id: compound_metric_configuration.id, kalibro_range: new_kalibro_range.to_hash |
229 | 229 | end |
230 | 230 | |
231 | - it { is_expected.to redirect_to(kalibro_configuration_compound_metric_configuration_path(compound_metric_configuration.kalibro_configuration_id, compound_metric_configuration.id)) } | |
231 | + it { is_expected.to redirect_to(kalibro_configuration_compound_metric_configuration_path(kalibro_configuration_id: compound_metric_configuration.kalibro_configuration_id, id: compound_metric_configuration.id)) } | |
232 | 232 | it { is_expected.to respond_with(:redirect) } |
233 | 233 | end |
234 | 234 | |
... | ... | @@ -251,7 +251,7 @@ describe KalibroRangesController, :type => :controller do |
251 | 251 | post :update, kalibro_configuration_id: metric_configuration.kalibro_configuration_id, id: kalibro_range.id, metric_configuration_id: metric_configuration.id, kalibro_range: kalibro_range_params |
252 | 252 | end |
253 | 253 | |
254 | - it { is_expected.to redirect_to kalibro_configurations_path(metric_configuration.kalibro_configuration_id) } | |
254 | + it { is_expected.to redirect_to kalibro_configurations_path(id: metric_configuration.kalibro_configuration_id) } | |
255 | 255 | end |
256 | 256 | end |
257 | 257 | end | ... | ... |
spec/controllers/metric_configurations_controller_spec.rb
... | ... | @@ -45,7 +45,7 @@ describe MetricConfigurationsController, :type => :controller do |
45 | 45 | post :new, kalibro_configuration_id: kalibro_configuration.id, metric_name: "Lines of Code", metric_collector_name: metric_collector.name |
46 | 46 | end |
47 | 47 | |
48 | - it { is_expected.to redirect_to(kalibro_configurations_url(kalibro_configuration.id)) } | |
48 | + it { is_expected.to redirect_to(kalibro_configurations_url(id: kalibro_configuration.id)) } | |
49 | 49 | it { is_expected.to respond_with(:redirect) } |
50 | 50 | end |
51 | 51 | end |
... | ... | @@ -129,7 +129,7 @@ describe MetricConfigurationsController, :type => :controller do |
129 | 129 | get :edit, id: metric_configuration.id, kalibro_configuration_id: metric_configuration.kalibro_configuration_id.to_s |
130 | 130 | end |
131 | 131 | |
132 | - it { is_expected.to redirect_to(kalibro_configurations_path(metric_configuration.kalibro_configuration_id)) } | |
132 | + it { is_expected.to redirect_to(kalibro_configurations_path(id: metric_configuration.kalibro_configuration_id)) } | |
133 | 133 | it { is_expected.to respond_with(:redirect) } |
134 | 134 | it { is_expected.to set_flash[:notice].to("You're not allowed to do this operation") } |
135 | 135 | end |
... | ... | @@ -166,7 +166,7 @@ describe MetricConfigurationsController, :type => :controller do |
166 | 166 | post :update, kalibro_configuration_id: metric_configuration.kalibro_configuration_id, id: metric_configuration.id, metric_configuration: metric_configuration_params |
167 | 167 | end |
168 | 168 | |
169 | - it { is_expected.to redirect_to(kalibro_configuration_path(metric_configuration.kalibro_configuration_id)) } | |
169 | + it { is_expected.to redirect_to(kalibro_configuration_path(id: metric_configuration.kalibro_configuration_id)) } | |
170 | 170 | it { is_expected.to respond_with(:redirect) } |
171 | 171 | end |
172 | 172 | |
... | ... | @@ -187,7 +187,7 @@ describe MetricConfigurationsController, :type => :controller do |
187 | 187 | post :update, kalibro_configuration_id: metric_configuration.kalibro_configuration_id, id: metric_configuration.id, metric_configuration: metric_configuration_params |
188 | 188 | end |
189 | 189 | |
190 | - it { is_expected.to redirect_to kalibro_configurations_path(metric_configuration.kalibro_configuration_id) } | |
190 | + it { is_expected.to redirect_to kalibro_configurations_path(id: metric_configuration.kalibro_configuration_id) } | |
191 | 191 | end |
192 | 192 | end |
193 | 193 | end |
... | ... | @@ -210,7 +210,7 @@ describe MetricConfigurationsController, :type => :controller do |
210 | 210 | delete :destroy, id: metric_configuration.id, kalibro_configuration_id: metric_configuration.kalibro_configuration_id.to_s |
211 | 211 | end |
212 | 212 | |
213 | - it { is_expected.to redirect_to(kalibro_configuration_path(metric_configuration.kalibro_configuration_id)) } | |
213 | + it { is_expected.to redirect_to(kalibro_configuration_path(id: metric_configuration.kalibro_configuration_id)) } | |
214 | 214 | it { is_expected.to respond_with(:redirect) } |
215 | 215 | end |
216 | 216 | |
... | ... | @@ -219,7 +219,7 @@ describe MetricConfigurationsController, :type => :controller do |
219 | 219 | delete :destroy, id: metric_configuration.id, kalibro_configuration_id: metric_configuration.kalibro_configuration_id.to_s |
220 | 220 | end |
221 | 221 | |
222 | - it { is_expected.to redirect_to(kalibro_configurations_path(metric_configuration.kalibro_configuration_id)) } | |
222 | + it { is_expected.to redirect_to(kalibro_configurations_path(id: metric_configuration.kalibro_configuration_id)) } | |
223 | 223 | it { is_expected.to respond_with(:redirect) } |
224 | 224 | end |
225 | 225 | end | ... | ... |
spec/controllers/repositories_controller_spec.rb
... | ... | @@ -60,7 +60,7 @@ describe RepositoriesController, :type => :controller do |
60 | 60 | post :create, project_id: project.id, repository: repository_params |
61 | 61 | end |
62 | 62 | |
63 | - it { is_expected.to redirect_to(project_repository_process_path(repository.project_id, repository.id)) } | |
63 | + it { is_expected.to redirect_to(project_repository_process_path(project_id: repository.project_id, id: repository.id)) } | |
64 | 64 | it { is_expected.to respond_with(:redirect) } |
65 | 65 | end |
66 | 66 | ... | ... |
spec/routing/home_routing_spec.rb
... | ... | @@ -4,5 +4,7 @@ describe HomeController, :type => :routing do |
4 | 4 | describe "routing" do |
5 | 5 | it { is_expected.to route(:get, '/'). |
6 | 6 | to(controller: :home, action: :index) } |
7 | + it { is_expected.to route(:get, '/pt'). | |
8 | + to(controller: :home, action: :index, locale: 'pt') } | |
7 | 9 | end |
8 | 10 | end |
9 | 11 | \ No newline at end of file | ... | ... |
spec/routing/project_routing_spec.rb
... | ... | @@ -8,6 +8,9 @@ describe ProjectsController, :type => :routing do |
8 | 8 | it { is_expected.to route(:get, '/projects'). |
9 | 9 | to(controller: :projects, action: :index) } |
10 | 10 | |
11 | + it { is_expected.to route(:get, '/pt/projects'). | |
12 | + to(controller: :projects, action: :index, locale: 'pt') } | |
13 | + | |
11 | 14 | it { is_expected.to route(:post, '/projects'). |
12 | 15 | to(controller: :projects, action: :create) } |
13 | 16 | ... | ... |