omniauthのfacebook sign in integrationを使用するように構成されたdeviseを使用しています。 私を得る私のspec/request
のテストからsign_in
メソッドを呼び出す:rspecとdeviseによる統合テストsign_in env
undefined method `env' for nil:NilClass
が仕様:
describe FacebookController do
include Devise::TestHelpers
it "should display facebook logged in status" do
@user = User.create(:id => "123", :token => "token")
sign_in @user
visit facebook_path
end
end
私はコントローラテストで動作するdevith github wikiの解決策です[https://github.com/plataformatec/devise/wiki/How-To:-Test-controllers-with-Rails-3-and-4 - (および-RSpec)](https://github.com/plataformatec/devise/wiki/How-To:-Test-controllers-with-Rails-3-and-4-(and-RSpec)) –