Merging.
This commit is contained in:
commit
0eb6133a70
1
Gemfile
1
Gemfile
|
@ -12,3 +12,4 @@ gemspec :path => 'oa-oauth'
|
|||
gemspec :path => 'oa-openid'
|
||||
|
||||
gem 'activerecord', '3.1.0.rc1'
|
||||
|
||||
|
|
|
@ -54,7 +54,8 @@ module OmniAuth
|
|||
|
||||
def registration_phase
|
||||
attributes = (options[:fields] + [:password, :password_confirmation]).inject({}){|h,k| h[k] = request[k.to_s]; h}
|
||||
if @identity = model.create(attributes)
|
||||
@identity = model.create(attributes)
|
||||
if @identity.persisted?
|
||||
env['PATH_INFO'] = callback_path
|
||||
callback_phase
|
||||
else
|
||||
|
|
|
@ -72,7 +72,8 @@ describe OmniAuth::Strategies::Identity do
|
|||
} }
|
||||
|
||||
before do
|
||||
MockIdentity.should_receive(:create).with(properties).and_return(mock(:uid => 'abc', :name => 'Awesome Dude', :email => 'awesome@example.com', :user_info => {:name => 'DUUUUDE!'}))
|
||||
m = mock(:uid => 'abc', :name => 'Awesome Dude', :email => 'awesome@example.com', :user_info => {:name => 'DUUUUDE!'}, :persisted? => true)
|
||||
MockIdentity.should_receive(:create).with(properties).and_return(m)
|
||||
end
|
||||
|
||||
it 'should set the auth hash' do
|
||||
|
@ -80,5 +81,23 @@ describe OmniAuth::Strategies::Identity do
|
|||
auth_hash['uid'].should == 'abc'
|
||||
end
|
||||
end
|
||||
|
||||
context 'with invalid identity' do
|
||||
let(:properties) { {
|
||||
:name => 'Awesome Dude',
|
||||
:email => 'awesome@example.com',
|
||||
:password => 'NOT',
|
||||
:password_confirmation => 'MATCHING'
|
||||
} }
|
||||
|
||||
before do
|
||||
MockIdentity.should_receive(:create).with(properties).and_return(mock(:persisted? => false))
|
||||
end
|
||||
|
||||
it 'should show registration form' do
|
||||
post '/auth/identity/register', properties
|
||||
last_response.body.should be_include("Register Identity")
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue