2014-12-01 2 views
0

왜 이것이 작동하지 않는지는 잘 모르겠습니다. 나는 omniauth에 대한 테스트를했고, 아래 스펙에서 (자동으로) 호출되는 set_omniauth 메소드가있다. 이 테스트는spec에 특정 도우미 파일을 포함하는 방법

RSpec에 사양/컨트롤러/sessions_controller_spec.rb

를 통해 호출하면 실패하지만, 전체 스위트 rspec spec 등을 통하여 실행될 때 전달합니다. spec/helpers/omniauth_helpers.rb 파일을 어떻게 포함시킬 수 있습니까? 나는 시도했다 :

require 'omniauth_helpers' 
require 'spec/helpers/omniauth_helpers' 
require 'omniauth_helpers.rb' 
require 'spec/helpers/omniauth_helpers.rb' 

그러나 그들은 작동하지 않는다.

require 'spec_helper' 

describe SessionsController, "OmniAuth", task049: true do 
    before do 
    request.env["omniauth.auth"] = OmniAuth.config.mock_auth[:facebook] # is set in 
    end 

    it "task049: sets a session variable to the OmniAuth auth hash - see the set_omniauth() in spec/helpers/omniauth_helpers" do 
    request.env["omniauth.auth"]['uid'].should == '1234fb' 
    end 
end 
+0

레일 애플리케이션입니까? 어떤 오류가 발생하고 있습니까? –

답변

0

그래서,이 해냈어 :

require 'spec_helper' 
require 'helpers/omniauth_helpers' 


describe SessionsController, "OmniAuth", task049: true do 

지난 밤 늦은 밤이었다

여기 내 사양입니다.

관련 문제