From b08608b261f8c9c552d8957b6231c7725b9529ac Mon Sep 17 00:00:00 2001 From: Drew Blessing Date: Mon, 2 Dec 2013 12:03:07 -0600 Subject: Issue 5716 - Allow removal of avatar Add class and style Add spinach tests Add entry to CHANGELOG Add entry to CHANGELOG --- features/profile/profile.feature | 8 ++++++++ features/steps/profile/profile.rb | 23 +++++++++++++++++++++++ 2 files changed, 31 insertions(+) (limited to 'features') diff --git a/features/profile/profile.feature b/features/profile/profile.feature index 6198fd2b306..6b0421a20b3 100644 --- a/features/profile/profile.feature +++ b/features/profile/profile.feature @@ -26,6 +26,14 @@ Feature: Profile Given I visit profile page Then I change my avatar And I should see new avatar + And I should see the "Remove avatar" button + + Scenario: I remove my avatar + Given I visit profile page + And I have an avatar + When I remove my avatar + Then I should see my gravatar + And I should not see the "Remove avatar" button Scenario: My password is expired Given my password is expired diff --git a/features/steps/profile/profile.rb b/features/steps/profile/profile.rb index 9d091e93aa2..3e4a105ec55 100644 --- a/features/steps/profile/profile.rb +++ b/features/steps/profile/profile.rb @@ -31,6 +31,29 @@ class Profile < Spinach::FeatureSteps @user.avatar.url.should == "/uploads/user/avatar/#{ @user.id }/gitlab_logo.png" end + step 'I should see the "Remove avatar" button' do + page.should have_link("Remove avatar") + end + + step 'I have an avatar' do + attach_file(:user_avatar, File.join(Rails.root, 'public', 'gitlab_logo.png')) + click_button "Save changes" + @user.reload + end + + step 'I remove my avatar' do + click_link "Remove avatar" + @user.reload + end + + step 'I should see my gravatar' do + @user.avatar?.should be_false + end + + step 'I should not see the "Remove avatar" button' do + page.should_not have_link("Remove avatar") + end + step 'I try change my password w/o old one' do within '.update-password' do fill_in "user_password", with: "22233344" -- cgit v1.2.3