From 2f35ace86d334541e5582201f864721567746bfa Mon Sep 17 00:00:00 2001 From: "dombi.attila" Date: Thu, 5 Jan 2012 12:44:51 +0200 Subject: [PATCH] mock_auth default is now an AuthHash instead of hash. --- lib/omniauth.rb | 4 ++-- spec/omniauth_spec.rb | 22 ++++++++++++++++++++++ 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/lib/omniauth.rb b/lib/omniauth.rb index 5e6bda1..d729019 100644 --- a/lib/omniauth.rb +++ b/lib/omniauth.rb @@ -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' } - } + ) } } diff --git a/spec/omniauth_spec.rb b/spec/omniauth_spec.rb index 7b9d65e..ce4cd4d 100644 --- a/spec/omniauth_spec.rb +++ b/spec/omniauth_spec.rb @@ -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