Permalink
Browse files

Merge pull request #564 from dombesz/master

mock_auth['default'] is a hash instead of being an AuthHash ( omniauth#558 )
  • Loading branch information...
2 parents 7c552af + 2f35ace commit 966a4653a5fdb53b836b34aa16163c64c3c02cb4 Michael Bleigh committed Jan 11, 2012
Showing with 24 additions and 2 deletions.
  1. +2 −2 lib/omniauth.rb
  2. +22 −0 spec/omniauth_spec.rb
View
4 lib/omniauth.rb
@@ -31,13 +31,13 @@ class Configuration
:test_mode => false,
:allowed_request_methods => [:get, :post],
:mock_auth => {
- :default => {
+ :default => AuthHash.new(
'provider' => 'default',
'uid' => '1234',
'info' => {
'name' => 'Bob Example'
}
- }
+ )
}
}
View
22 spec/omniauth_spec.rb
@@ -52,6 +52,28 @@
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

0 comments on commit 966a465

Please sign in to comment.