Welcome to mirror list, hosted at ThFree Co, Russian Federation.

profile_spec.rb « requests « spec - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 5838f63b40b71ef64fbd21dbeb35a8d201fe61a0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
require 'spec_helper'

describe "Profile" do
  before do 
    login_as :user
  end

  describe "Show profile" do
    before do 
      visit profile_path
    end

    it { page.should have_content(@user.name) }
    it { page.should have_content(@user.email) }
  end

  describe "Profile update" do
    before do 
      visit profile_path
      fill_in "user_skype", :with => "testskype"
      fill_in "user_linkedin", :with => "testlinkedin"      
      fill_in "user_twitter", :with => "testtwitter"
      click_button "Save"
      @user.reload     
    end

    it { @user.skype.should == 'testskype' }
    it { @user.linkedin.should == 'testlinkedin' }
    it { @user.twitter.should == 'testtwitter' }
  end


  describe "Password update" do
    before do 
      visit profile_password_path
    end

    it { page.should have_content("Password") }
    it { page.should have_content("Password confirmation") }

    describe "change password" do 
      before do 
        @old_pwd = @user.encrypted_password 
        fill_in "user_password", :with => "777777"
        fill_in "user_password_confirmation", :with => "777777"
        click_button "Save"
        @user.reload
      end

      it "should redirect to signin page" do
        current_path.should == new_user_session_path
      end

      it "should change password" do 
        @user.encrypted_password.should_not == @old_pwd
      end

      describe "login with new password" do 
        before do
          fill_in "user_email", :with => @user.email
          fill_in "user_password", :with => "777777"
          click_button "Sign in"
        end
        
        it "should login user" do 
          current_path.should == root_path
        end
      end
    end
  end
end