2011-10-08 23:36:38 +02:00
|
|
|
require 'spec_helper'
|
|
|
|
|
|
|
|
describe "Profile" do
|
2011-10-26 15:46:25 +02:00
|
|
|
before do
|
2011-10-08 23:36:38 +02:00
|
|
|
login_as :user
|
|
|
|
end
|
|
|
|
|
|
|
|
describe "Show profile" do
|
2011-10-26 15:46:25 +02:00
|
|
|
before do
|
2011-10-08 23:36:38 +02:00
|
|
|
visit profile_path
|
|
|
|
end
|
|
|
|
|
|
|
|
it { page.should have_content(@user.name) }
|
|
|
|
it { page.should have_content(@user.email) }
|
|
|
|
end
|
|
|
|
|
2011-10-20 00:34:05 +02:00
|
|
|
describe "Profile update" do
|
2011-10-26 15:46:25 +02:00
|
|
|
before do
|
2011-10-20 00:34:05 +02:00
|
|
|
visit profile_path
|
|
|
|
fill_in "user_skype", :with => "testskype"
|
2011-10-26 15:46:25 +02:00
|
|
|
fill_in "user_linkedin", :with => "testlinkedin"
|
2011-10-20 00:34:05 +02:00
|
|
|
fill_in "user_twitter", :with => "testtwitter"
|
|
|
|
click_button "Save"
|
2011-10-26 15:46:25 +02:00
|
|
|
@user.reload
|
2011-10-20 00:34:05 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
it { @user.skype.should == 'testskype' }
|
|
|
|
it { @user.linkedin.should == 'testlinkedin' }
|
|
|
|
it { @user.twitter.should == 'testtwitter' }
|
|
|
|
end
|
|
|
|
|
2011-10-08 23:36:38 +02:00
|
|
|
describe "Password update" do
|
2011-10-26 15:46:25 +02:00
|
|
|
before do
|
2011-10-08 23:36:38 +02:00
|
|
|
visit profile_password_path
|
|
|
|
end
|
|
|
|
|
|
|
|
it { page.should have_content("Password") }
|
|
|
|
it { page.should have_content("Password confirmation") }
|
|
|
|
|
2011-10-26 15:46:25 +02:00
|
|
|
describe "change password" do
|
|
|
|
before do
|
|
|
|
@old_pwd = @user.encrypted_password
|
2011-10-08 23:36:38 +02:00
|
|
|
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
|
|
|
|
|
2011-10-26 15:46:25 +02:00
|
|
|
it "should change password" do
|
2011-10-08 23:36:38 +02:00
|
|
|
@user.encrypted_password.should_not == @old_pwd
|
|
|
|
end
|
|
|
|
|
2011-10-26 15:46:25 +02:00
|
|
|
describe "login with new password" do
|
2011-10-08 23:36:38 +02:00
|
|
|
before do
|
|
|
|
fill_in "user_email", :with => @user.email
|
|
|
|
fill_in "user_password", :with => "777777"
|
|
|
|
click_button "Sign in"
|
|
|
|
end
|
2011-10-26 15:46:25 +02:00
|
|
|
|
|
|
|
it "should login user" do
|
2011-10-08 23:36:38 +02:00
|
|
|
current_path.should == root_path
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|