2019-07-25 01:24:42 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2017-09-16 06:09:58 -04:00
|
|
|
require 'spec_helper'
|
|
|
|
|
|
|
|
describe 'User visits their profile' do
|
|
|
|
let(:user) { create(:user) }
|
|
|
|
|
|
|
|
before do
|
|
|
|
sign_in(user)
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'shows correct menu item' do
|
2018-02-12 14:17:19 -05:00
|
|
|
visit(profile_path)
|
|
|
|
|
2017-09-16 06:09:58 -04:00
|
|
|
expect(page).to have_active_navigation('Profile')
|
|
|
|
end
|
2018-02-07 16:45:03 -05:00
|
|
|
|
2018-02-12 14:17:19 -05:00
|
|
|
it 'shows profile info' do
|
|
|
|
visit(profile_path)
|
|
|
|
|
|
|
|
expect(page).to have_content "This information will appear on your profile"
|
|
|
|
end
|
|
|
|
|
|
|
|
context 'when user has groups' do
|
|
|
|
let(:group) do
|
|
|
|
create :group do |group|
|
|
|
|
group.add_owner(user)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
let!(:project) do
|
|
|
|
create(:project, :repository, namespace: group) do |project|
|
|
|
|
create(:closed_issue_event, project: project)
|
2018-07-11 10:36:08 -04:00
|
|
|
project.add_maintainer(user)
|
2018-02-12 14:17:19 -05:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
def click_on_profile_picture
|
|
|
|
find(:css, '.header-user-dropdown-toggle').click
|
|
|
|
|
|
|
|
page.within ".header-user" do
|
|
|
|
click_link "Profile"
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'shows user groups', :js do
|
|
|
|
visit(profile_path)
|
|
|
|
click_on_profile_picture
|
|
|
|
|
|
|
|
page.within ".cover-block" do
|
|
|
|
expect(page).to have_content user.name
|
|
|
|
expect(page).to have_content user.username
|
|
|
|
end
|
|
|
|
|
|
|
|
page.within ".content" do
|
|
|
|
click_link "Groups"
|
|
|
|
end
|
2018-02-07 16:45:03 -05:00
|
|
|
|
2018-02-12 14:17:19 -05:00
|
|
|
page.within "#groups" do
|
|
|
|
expect(page).to have_content group.name
|
|
|
|
end
|
2018-02-07 16:45:03 -05:00
|
|
|
end
|
|
|
|
end
|
2017-09-16 06:09:58 -04:00
|
|
|
end
|