FEATURE: raise an exception when the email is missing in the OpenId callback

This commit is contained in:
Régis Hanol
2014-08-07 19:28:50 +02:00
parent 1db40fce22
commit 7c65adfd6f
2 changed files with 8 additions and 1 deletions

View File

@ -16,4 +16,10 @@ describe Auth::OpenIdAuthenticator do
result = auth.after_authenticate(info: {email: user.email}, extra: {response: response})
result.user.should == user
end
it "raises an exception when email is missing" do
auth = Auth::OpenIdAuthenticator.new("test", "id", trusted: true)
response = OpenStruct.new(identity_url: 'abc')
-> { auth.after_authenticate(info: {}, extra: { response: response }) }.should raise_error(Discourse::InvalidParameters)
end
end