profile.rb 2.3 KB
Newer Older
1
class Profile < Spinach::FeatureSteps
N
Nihad Abbasov 已提交
2 3
  include SharedAuthentication
  include SharedPaths
4 5 6 7 8 9 10 11

  Then 'I should see my profile info' do
    page.should have_content "Profile"
    page.should have_content @user.name
    page.should have_content @user.email
  end

  Then 'I change my contact info' do
12 13 14
    fill_in "user_skype", with: "testskype"
    fill_in "user_linkedin", with: "testlinkedin"
    fill_in "user_twitter", with: "testtwitter"
15 16 17 18 19 20 21 22 23 24 25
    click_button "Save"
    @user.reload
  end

  And 'I should see new contact info' do
    @user.skype.should == 'testskype'
    @user.linkedin.should == 'testlinkedin'
    @user.twitter.should == 'testtwitter'
  end

  Then 'I change my password' do
26
    within '.update-password' do
27 28
      fill_in "user_password", with: "222333"
      fill_in "user_password_confirmation", with: "222333"
29 30
      click_button "Save"
    end
31 32
  end

33
  When 'I unsuccessfully change my password' do
34 35 36 37 38
    within '.update-password' do
      fill_in "user_password", with: "password"
      fill_in "user_password_confirmation", with: "confirmation"
      click_button "Save"
    end
39 40 41 42 43 44
  end

  Then "I should see a password error message" do
    page.should have_content "Password doesn't match confirmation"
  end

45 46 47 48 49
  And 'I should be redirected to sign in page' do
    current_path.should == new_user_session_path
  end

  Then 'I reset my token' do
50 51 52 53
    within '.update-token' do
      @old_token = @user.private_token
      click_button "Reset"
    end
54 55 56 57 58 59
  end

  And 'I should see new token' do
    find("#token").value.should_not == @old_token
    find("#token").value.should == @user.reload.private_token
  end
R
randx 已提交
60 61

  Given 'I have activity' do
62
    create(:closed_issue_event, author: current_user)
R
randx 已提交
63 64 65 66 67
  end

  Then 'I should see my activity' do
    page.should have_content "#{current_user.name} closed issue"
  end
68 69

  When "I change my application theme" do
70 71 72
    within '.application-theme' do
      choose "Violet"
    end
73 74 75
  end

  When "I change my code preview theme" do
76
    within '.code-preview-theme' do
77
      choose "Solarized dark"
78
    end
79 80 81 82 83 84 85 86 87 88
  end

  Then "I should see the theme change immediately" do
    page.should have_selector('body.ui_color')
    page.should_not have_selector('body.ui_basic')
  end

  Then "I should receive feedback that the changes were saved" do
    page.should have_content("Saved")
  end
89
end