-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add tests to check lanugage selection
- Loading branch information
1 parent
7df7e6e
commit a1006ca
Showing
2 changed files
with
82 additions
and
48 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,45 @@ | ||
require 'rails_helper' | ||
|
||
describe 'Check routes', type: :feature, js: true do | ||
ROUTES = { | ||
"/": "/de/people", | ||
"/de/": "/de/people", | ||
"/people": "/de/people", | ||
"/people_skills": "/de/people_skills", | ||
"/en": "/en/people", | ||
} | ||
describe 'Routing', type: :feature, js: true do | ||
|
||
let(:bob) { people(:bob) } | ||
|
||
before(:each) do | ||
sign_in auth_users(:user), scope: :auth_user | ||
end | ||
|
||
ROUTES.each do |url, target| | ||
it "Should route from '#{url}' to #{target}" do | ||
visit url | ||
expect(current_path).to eq(target) | ||
describe "Check auto rerouting" do | ||
ROUTES = { | ||
"/": "/de/people", | ||
"/de/": "/de/people", | ||
"/people": "/de/people", | ||
"/people_skills": "/de/people_skills", | ||
"/en": "/en/people", | ||
} | ||
|
||
|
||
|
||
ROUTES.each do |url, target| | ||
it "Should route from '#{url}' to #{target}" do | ||
visit url | ||
expect(current_path).to eq(target) | ||
end | ||
end | ||
end | ||
|
||
describe "Check if language is applied correctly" do | ||
context "Set locale via dropdown" do | ||
before(:each) do | ||
visit root_path | ||
select 'Italienisch', from: "i18n_language" | ||
end | ||
|
||
it "Should open profile with correct language" do | ||
select_from_slim_select("#person_id_person", bob.name) | ||
expect(page).to have_text("Dati personali") | ||
click_link(href: person_people_skills_path(bob)) | ||
expect(page).to have_text("Nuove competenze per la valutazione") | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters