-
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.
- Loading branch information
1 parent
d74b5aa
commit 6bec7da
Showing
4 changed files
with
98 additions
and
11 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
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
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 |
---|---|---|
@@ -0,0 +1,20 @@ | ||
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" | ||
} | ||
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) | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
require 'rails_helper' | ||
|
||
describe 'Tabbar', type: :feature, js:true do | ||
let(:bob) { people(:bob) } | ||
|
||
let(:global_tabs){ | ||
[ | ||
{ title: t('global.navbar.profile'), path: people_path }, | ||
{ title: t('global.navbar.skill_search'), path: people_skills_path }, | ||
{ title: t('global.navbar.cv_search'), path: cv_search_index_path }, | ||
{ title: t('global.navbar.skillset'), path: skills_path } | ||
] | ||
} | ||
|
||
let(:person_tabs) { | ||
[ | ||
{ title: 'CV', path: person_path(bob) }, | ||
{ title: 'Skills', path: person_people_skills_path(bob) } | ||
] | ||
} | ||
|
||
before(:each) do | ||
sign_in auth_users(:admin) | ||
visit root_path | ||
end | ||
|
||
describe 'Global' do | ||
it 'Should highlight right tab using click' do | ||
global_tabs.each do |hash| | ||
click_link(href: hash[:path]) | ||
check_highlighted_tab(hash[:title]) | ||
end | ||
end | ||
|
||
it 'Should highlight right tab after visit by url' do | ||
global_tabs.each do |hash| | ||
visit (hash[:path]) | ||
check_highlighted_tab(hash[:title]) | ||
end | ||
end | ||
|
||
|
||
def check_highlighted_tab(text) | ||
expect(page).to have_selector("div.skills-navbar .btn .nav-link.active", text: text) | ||
end | ||
end | ||
|
||
describe 'Person' do | ||
|
||
it 'Should highlight right tab using dropdown' do | ||
person_tabs.each do |hash| | ||
visit root_path | ||
select_from_slim_select("#person_id_person", bob.name) | ||
check_highlighted_tab("CV") | ||
click_link(href: hash[:path]) | ||
check_highlighted_tab(hash[:title]) | ||
end | ||
end | ||
|
||
it 'Should highlight right tab after visit by url' do | ||
person_tabs.each do |hash| | ||
visit (hash[:path]) | ||
check_highlighted_tab(hash[:title]) | ||
end | ||
end | ||
|
||
def check_highlighted_tab(text) | ||
expect(page).to have_selector(".nav.nav-tabs .btn .nav-link.active", text: text) | ||
end | ||
end | ||
end |