Merge pull request #564 from dombesz/master

mock_auth['default'] is a hash instead of being an AuthHash ( https://github.com/intridea/omniauth/issues/558 )
This commit is contained in:
Michael Bleigh 2012-01-11 07:06:55 -08:00
commit 966a4653a5
2 changed files with 24 additions and 2 deletions

View File

@ -31,13 +31,13 @@ module OmniAuth
:test_mode => false,
:allowed_request_methods => [:get, :post],
:mock_auth => {
:default => {
:default => AuthHash.new(
'provider' => 'default',
'uid' => '1234',
'info' => {
'name' => 'Bob Example'
}
}
)
}
}

View File

@ -52,6 +52,28 @@ describe OmniAuth do
OmniAuth.config.on_failure.call.should == 'yoyo'
end
describe 'mock auth' do
before do
OmniAuth.config.add_mock(:facebook, :uid => '12345',:info=>{:name=>'Joe', :email=>'joe@example.com'})
end
it 'default should be AuthHash' do
OmniAuth.configure do |config|
config.mock_auth[:default].should be_kind_of(OmniAuth::AuthHash)
end
end
it 'facebook should be AuthHash' do
OmniAuth.configure do |config|
config.mock_auth[:facebook].should be_kind_of(OmniAuth::AuthHash)
end
end
it 'should set facebook attributes' do
OmniAuth.configure do |config|
config.mock_auth[:facebook].uid.should eq('12345')
config.mock_auth[:facebook].info.name.should eq('Joe')
config.mock_auth[:facebook].info.email.should eq('joe@example.com')
end
end
end
end
describe '::Utils' do