2
나는 omniauth를 테스트하려고합니다. 나는omniauth-facebook 및 rspec 테스트
OmniAuth.config.add_mock(:facebook,
{ :provider => 'facebook',
:uid => '1234567',
:info => { :first_name => 'Jonathan', :name=> 'Jonathan', :email => '[email protected]', :image => 'http://graph.facebook.com/1234567/picture?type=square'},
:credentials => {
:expires_at => 1351270850,
:token=> 'AAADzk0b791YBAHCNhBI3n6ScmWvuXTY4yIUqXr9WiZCg1R808RYzaHxsHnrbn62IwrIgZCfSBZAVIP6ptF41nm8YtRtZCeBbxbbz1mF8RQZDZD'
} })
설정/환경/test.rb
OmniAuth.config.test_mode = true
에 내 spec_helper.rb에 넣어 다음 내 요청 컨트롤러에 있습니다 :
it "testing omniauth hash" do
visit '/auth/facebook'
request.env["omniauth.auth"][:uid].should == '1234567'
end
를 얻을 :
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
어떤 아이디어가 나올지 에? 사전에 들으
편집 한
thx,하지만 ... 음 ... 같은 오류. OmniAuth.config.test_mode = true가 환경 파일 또는 spec_helper.rb에 있어야합니까? – timpone
@timpone 편집 – cdesrosiers
흠 ... 여전히 같은 오류가 발생합니다. 위의 스크린 샷을 추가했습니다. 잘 모르겠지만 도움을 청합니다. – timpone