2017-02-16 22:02:40 +00:00
|
|
|
require 'spec_helper'
|
|
|
|
|
|
|
|
describe 'User Callouts', js: true do
|
|
|
|
let(:user) { create(:user) }
|
2017-03-23 22:40:36 +00:00
|
|
|
let(:another_user) { create(:user) }
|
2017-02-16 22:02:40 +00:00
|
|
|
let(:project) { create(:empty_project, path: 'gitlab', name: 'sample') }
|
|
|
|
|
|
|
|
before do
|
|
|
|
login_as(user)
|
2017-03-24 12:41:42 +00:00
|
|
|
project.team << [user, :master]
|
2017-02-16 22:02:40 +00:00
|
|
|
end
|
|
|
|
|
2017-03-24 12:41:42 +00:00
|
|
|
it 'takes you to the profile preferences when the link is clicked' do
|
2017-02-16 22:02:40 +00:00
|
|
|
visit dashboard_projects_path
|
|
|
|
click_link 'Check it out'
|
|
|
|
expect(current_path).to eq profile_preferences_path
|
|
|
|
end
|
|
|
|
|
2017-03-24 12:41:42 +00:00
|
|
|
it 'does not show when cookie is set' do
|
|
|
|
visit dashboard_projects_path
|
|
|
|
|
|
|
|
within('.user-callout') do
|
2017-05-08 20:08:39 +00:00
|
|
|
find('.close').trigger('click')
|
2017-03-24 12:41:42 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
visit dashboard_projects_path
|
|
|
|
|
|
|
|
expect(page).not_to have_selector('.user-callout')
|
|
|
|
end
|
|
|
|
|
2017-02-16 22:02:40 +00:00
|
|
|
describe 'user callout should appear in two routes' do
|
|
|
|
it 'shows up on the user profile' do
|
|
|
|
visit user_path(user)
|
2017-02-17 17:28:52 +00:00
|
|
|
expect(find('.user-callout')).to have_content 'Customize your experience'
|
2017-02-16 22:02:40 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
it 'shows up on the dashboard projects' do
|
|
|
|
visit dashboard_projects_path
|
2017-02-17 17:28:52 +00:00
|
|
|
expect(find('.user-callout')).to have_content 'Customize your experience'
|
2017-02-16 22:02:40 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'hides the user callout when click on the dismiss icon' do
|
|
|
|
visit user_path(user)
|
2017-02-17 17:28:52 +00:00
|
|
|
within('.user-callout') do
|
2017-03-24 12:41:42 +00:00
|
|
|
find('.close').click
|
2017-02-16 22:02:40 +00:00
|
|
|
end
|
2017-03-23 22:40:36 +00:00
|
|
|
expect(page).not_to have_selector('.user-callout')
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'does not show callout on another users profile' do
|
|
|
|
visit user_path(another_user)
|
|
|
|
expect(page).not_to have_selector('.user-callout')
|
2017-02-16 22:02:40 +00:00
|
|
|
end
|
2017-02-16 23:45:05 +00:00
|
|
|
end
|