Update specs
This commit is contained in:
parent
4a6186f523
commit
dccca52c26
@ -38,9 +38,11 @@ class UsersController < ApplicationController
|
|||||||
private
|
private
|
||||||
|
|
||||||
def load_sensitive_user_data_from_session
|
def load_sensitive_user_data_from_session
|
||||||
@user.provider = session[:new_user][:provider]
|
if session[:new_user]
|
||||||
@user.uid = session[:new_user][:uid]
|
@user.provider = session[:new_user][:provider]
|
||||||
@user.avatar_url = session[:new_user][:avatar_url]
|
@user.uid = session[:new_user][:uid]
|
||||||
|
@user.avatar_url = session[:new_user][:avatar_url]
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def clear_sensitive_session_user_data
|
def clear_sensitive_session_user_data
|
||||||
|
@ -73,8 +73,8 @@ describe SessionsController do
|
|||||||
it "puts uid and provider in session " do
|
it "puts uid and provider in session " do
|
||||||
post :create
|
post :create
|
||||||
|
|
||||||
session[:uid].should == uid
|
session[:new_user][:uid].should == uid
|
||||||
session[:provider].should == provider
|
session[:new_user][:provider].should == provider
|
||||||
end
|
end
|
||||||
|
|
||||||
it "renders user/new" do
|
it "renders user/new" do
|
||||||
|
@ -12,10 +12,14 @@ describe UsersController do
|
|||||||
context "when user saved" do
|
context "when user saved" do
|
||||||
let(:provider) { 'foo' }
|
let(:provider) { 'foo' }
|
||||||
let(:uid) { '123' }
|
let(:uid) { '123' }
|
||||||
|
let(:avatar_url) { 'url' }
|
||||||
|
|
||||||
before do
|
before do
|
||||||
session[:provider] = provider
|
session[:new_user] = {
|
||||||
session[:uid] = uid
|
:provider => provider,
|
||||||
|
:uid => uid,
|
||||||
|
:avatar_url => avatar_url
|
||||||
|
}
|
||||||
|
|
||||||
user.stub!(:save => true)
|
user.stub!(:save => true)
|
||||||
end
|
end
|
||||||
@ -23,6 +27,7 @@ describe UsersController do
|
|||||||
it "assigns provider and uid" do
|
it "assigns provider and uid" do
|
||||||
user.should_receive(:provider=).with(provider).and_return(true)
|
user.should_receive(:provider=).with(provider).and_return(true)
|
||||||
user.should_receive(:uid=).with(uid).and_return(true)
|
user.should_receive(:uid=).with(uid).and_return(true)
|
||||||
|
user.should_receive(:avatar_url=).with(avatar_url).and_return(true)
|
||||||
|
|
||||||
post :create
|
post :create
|
||||||
end
|
end
|
||||||
@ -35,8 +40,7 @@ describe UsersController do
|
|||||||
it "clears user session data" do
|
it "clears user session data" do
|
||||||
post :create
|
post :create
|
||||||
|
|
||||||
session[:provider].should be_nil
|
session[:new_user].should be_nil
|
||||||
session[:uid].should be_nil
|
|
||||||
end
|
end
|
||||||
|
|
||||||
it "redirects back" do
|
it "redirects back" do
|
||||||
|
@ -11,6 +11,6 @@ describe "users/new" do
|
|||||||
render
|
render
|
||||||
rendered.should =~ /user\[nickname\]/
|
rendered.should =~ /user\[nickname\]/
|
||||||
rendered.should =~ /user\[name\]/
|
rendered.should =~ /user\[name\]/
|
||||||
rendered.should =~ /user\[avatar_url\]/
|
rendered.should =~ /user\[email\]/
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user