forked from omniauth/omniauth-identity
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
41 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -109,11 +109,32 @@ def set_app!(identity_options = {}) | |
post '/auth/identity/register', properties | ||
auth_hash['uid'].should == 'abc' | ||
end | ||
|
||
context 'custom validation stage' do | ||
|
||
context 'validation method returns true' do | ||
it 'should register the user normally' do | ||
set_app!(:on_validation => lambda{|env| true}) | ||
|
||
post '/auth/identity/register', properties | ||
identity_hash.should_not be_nil | ||
end | ||
end | ||
|
||
context 'validation method returns false' do | ||
it 'should not register the user' do | ||
set_app!(:on_validation => lambda{|env| false}) | ||
|
||
post '/auth/identity/register', properties | ||
identity_hash.should be_nil | ||
end | ||
end | ||
end | ||
end | ||
|
||
context 'with invalid identity' do | ||
let(:properties) { { | ||
:name => 'Awesome Dude', | ||
:name => 'Awesome Dude', | ||
:email => '[email protected]', | ||
:password => 'NOT', | ||
:password_confirmation => 'MATCHING' | ||
|