I am trying to just test omniauth. I have put in config/environments/test.rb
OmniAuth.config.test_mode = true
and in my spec_helper.rb
OmniAuth.config.add_mock(:facebook,
{ :provider => 'facebook',
:uid => '1234567',
:info => { :first_name => 'Jonathan', :name=> 'Jonathan', :email => 'jon@jak.com', :image => 'http://graph.facebook.com/1234567/picture?type=square'},
:credentials => {
:expires_at => 1351270850,
:token=> 'AAADzk0b791YBAHCNhBI3n6ScmWvuXTY4yIUqXr9WiZCg1R808RYzaHxsHnrbn62IwrIgZCfSBZAVIP6ptF41nm8YtRtZCeBbxbbz1mF8RQZDZD'
} })
and then in my request controller:
it "testing omniauth hash" do
visit '/auth/facebook'
request.env["omniauth.auth"][:uid].should == '1234567'
end
and get:
Failures:
1) Login logins with the OmniAuth auth hash
Failure/Error: request.env["omniauth.auth"][:uid].should == '1234567'
NoMethodError:
undefined method `env' for nil:NilClass
# ./spec/requests/login_spec.rb:38:in `block (2 levels) in <top (required)>'
Finished in 2.4 seconds
9 examples, 1 failure
Any idea what is going on? thx in advance
edit 1