Ruby on rails 设计Omniauth脸谱网;未初始化常量OmniAuth“;
我正在尝试设置Omniauth Facebook与rspec的测试集成。我很难为rspec初学者找到好的文档,所以我可能做错了什么。尝试运行规范文件时出现以下错误:Ruby on rails 设计Omniauth脸谱网;未初始化常量OmniAuth“;,ruby-on-rails,rspec,devise,omniauth,omniauth-facebook,Ruby On Rails,Rspec,Devise,Omniauth,Omniauth Facebook,我正在尝试设置Omniauth Facebook与rspec的测试集成。我很难为rspec初学者找到好的文档,所以我可能做错了什么。尝试运行规范文件时出现以下错误: /home/nitrous/workspace/spell-hub/spec/spec_helper.rb:22:in `block in <top (required)>': uninitialized constant OmniAuth (NameError) from /home/nitrous/w
/home/nitrous/workspace/spell-hub/spec/spec_helper.rb:22:in `block in <top (required)>': uninitialized constant OmniAuth (NameError)
from /home/nitrous/workspace/spell-hub/.bundle/gems/rspec-core-3.3.2/lib/rspec/core.rb:97:in `configure'
from /home/nitrous/workspace/spell-hub/spec/spec_helper.rb:21:in `<top (required)>'
from /home/nitrous/workspace/spell-hub/.bundle/gems/rspec-core-3.3.2/lib/rspec/core/configuration.rb:1280:in `require'
from /home/nitrous/workspace/spell-hub/.bundle/gems/rspec-core-3.3.2/lib/rspec/core/configuration.rb:1280:in `block in requires='
from /home/nitrous/workspace/spell-hub/.bundle/gems/rspec-core-3.3.2/lib/rspec/core/configuration.rb:1280:in `each'
from /home/nitrous/workspace/spell-hub/.bundle/gems/rspec-core-3.3.2/lib/rspec/core/configuration.rb:1280:in `requires='
在spec/integrations/omniauth\u sessions\u spec.rb中
require 'rails_helper'
RSpec.describe "omniauth facebook", :type => :request do
it "should have a return UID of 1234567" do
visit 'users/auth/facebook'
request.env["omniauth.auth"][:uid].should == '1234567'
end
end
我怎样才能解决这个问题?谢谢 我最终需要在spec\u helper.rb中为将来有此问题的任何人添加
require'omniauth'
。我最终需要在spec\u helper.rb中为将来有此问题的任何人添加require'omniauth'
。遗憾的是,这对我没有用。遗憾的是,这对我没有用。
require 'rails_helper'
RSpec.describe "omniauth facebook", :type => :request do
it "should have a return UID of 1234567" do
visit 'users/auth/facebook'
request.env["omniauth.auth"][:uid].should == '1234567'
end
end