1 class Profile < Spinach::FeatureSteps
2 include SharedAuthentication
5 step 'I should see my profile info' do
6 page.should have_content "Profile settings"
9 step 'I change my contact info' do
10 fill_in "user_skype", with: "testskype"
11 fill_in "user_linkedin", with: "testlinkedin"
12 fill_in "user_twitter", with: "testtwitter"
13 click_button "Save changes"
17 step 'I should see new contact info' do
18 @user.skype.should == 'testskype'
19 @user.linkedin.should == 'testlinkedin'
20 @user.twitter.should == 'testtwitter'
23 step 'I change my avatar' do
24 attach_file(:user_avatar, File.join(Rails.root, 'public', 'gitlab_logo.png'))
25 click_button "Save changes"
29 step 'I should see new avatar' do
30 @user.avatar.should be_instance_of AttachmentUploader
31 @user.avatar.url.should == "/uploads/user/avatar/#{ @user.id }/gitlab_logo.png"
34 step 'I should see the "Remove avatar" button' do
35 page.should have_link("Remove avatar")
38 step 'I have an avatar' do
39 attach_file(:user_avatar, File.join(Rails.root, 'public', 'gitlab_logo.png'))
40 click_button "Save changes"
44 step 'I remove my avatar' do
45 click_link "Remove avatar"
49 step 'I should see my gravatar' do
50 @user.avatar?.should be_false
53 step 'I should not see the "Remove avatar" button' do
54 page.should_not have_link("Remove avatar")
57 step 'I try change my password w/o old one' do
58 within '.update-password' do
59 fill_in "user_password", with: "22233344"
60 fill_in "user_password_confirmation", with: "22233344"
65 step 'I change my password' do
66 within '.update-password' do
67 fill_in "user_current_password", with: "12345678"
68 fill_in "user_password", with: "22233344"
69 fill_in "user_password_confirmation", with: "22233344"
74 step 'I unsuccessfully change my password' do
75 within '.update-password' do
76 fill_in "user_current_password", with: "12345678"
77 fill_in "user_password", with: "password"
78 fill_in "user_password_confirmation", with: "confirmation"
83 step "I should see a missing password error message" do
84 page.should have_content "You must provide a valid current password"
87 step "I should see a password error message" do
88 page.should have_content "Password doesn't match confirmation"
91 step 'I reset my token' do
92 within '.update-token' do
93 @old_token = @user.private_token
98 step 'I should see new token' do
99 find("#token").value.should_not == @old_token
100 find("#token").value.should == @user.reload.private_token
103 step 'I have activity' do
104 create(:closed_issue_event, author: current_user)
107 step 'I should see my activity' do
108 page.should have_content "#{current_user.name} closed issue"
111 step "I change my application theme" do
112 within '.application-theme' do
117 step "I change my code preview theme" do
118 within '.code-preview-theme' do
119 choose "Solarized dark"
123 step "I should see the theme change immediately" do
124 page.should have_selector('body.ui_color')
125 page.should_not have_selector('body.ui_basic')
128 step "I should receive feedback that the changes were saved" do
129 page.should have_content("saved")
132 step 'my password is expired' do
133 current_user.update_attributes(password_expires_at: Time.now - 1.hour)
136 step "I am not an ldap user" do
137 current_user.update_attributes(extern_uid: nil, provider: '')
138 current_user.ldap_user?.should be_false
141 step 'I redirected to expired password page' do
142 current_path.should == new_profile_password_path
145 step 'I submit new password' do
146 fill_in :user_password, with: '12345678'
147 fill_in :user_password_confirmation, with: '12345678'
148 click_button "Set new password"
151 step 'I redirected to sign in page' do
152 current_path.should == new_user_session_path
155 step 'I should be redirected to password page' do
156 current_path.should == edit_profile_password_path
159 step 'I should be redirected to account page' do
160 current_path.should == profile_account_path
163 step 'I click on my profile picture' do
164 click_link 'profile-pic'
167 step 'I should see my user page' do
168 page.should have_content "User Activity"
170 within '.navbar-gitlab' do
171 page.should have_content current_user.name