0

Rails v2.3 애플리케이션을 개발 중입니다.컨트롤러의 rspec 테스트를 실행할 때 Rspec 오류가 발생했습니다.

나는 명령을 실행하여 RSpec에 테스트를 실행하면 : rspec spec/controllers/my_controller_spec.rb

내가 아래에 표시되어있는 오류 메시지을 얻었다을 :

/.rvm/gems/[email protected]/gems/rspec-core-2.6.4/lib/rspec/core/configuration.rb:427:in `raise_if_rspec_1_is_loaded': (RuntimeError) 
******************************************************************************** 
    You are running rspec-2, but it seems as though rspec-1 has been loaded as 
    well. This is likely due to a statement like this somewhere in the specs: 

     require 'spec' 

    Please locate that statement, remove it, and try again. 
******************************************************************************** 
/.rvm/gems/[email protected]/gems/rspec-core-2.6.4/lib/rspec/core/configuration.rb:420:in `load_spec_files' 

---- 갱신 ---

가 코드 require 'spec' 포함 된 일부 파일에 대한 불만 때문에, 그래서이 단서를 따라 내가 에게 그것을 제거 후 나는 사양/그러나 spec_helper.rb, 에서 "require 'spec'을"발견의 같은 오류가 계속 인상을 업로드하고 코드를 포함하고있는 다른 파일이 없습니다.

왜 여전히 오류가 발생합니까? 그때 실제 원인은 무엇입니까?

+0

config/test.rb 및 spec_helper 파일은 어떻게 보이나요? –

+0

@ Alok, confi/test.rb에서 "require 'spec'"을 찾았습니다. 제거한 후에도 같은 오류가 계속 발생하고 다른 파일에 코드가 들어 있지 않습니다. –

답변

5

rspecrspec-2의 실행 파일입니다. specrspec-1의 실행 파일입니다. rspec-2rails 2.3과 호환되지 않습니다. 명령은 다음과 같아야합니다.

spec spec/controllers/my_controller_spec.rb