2012-04-19 1 views
6

...그룹을 사용하는 rspec에 대해서만 시작하려는 경우에도 rspec 및 오이 모두 가드가 spork를 시작하는 이유는 무엇입니까? (: 사양 및 : 기능) 내 Gemfile에

group :development, :test do 
    gem 'capybara', "1.1.2" 
    gem 'database_cleaner', "0.7.0" 

    gem 'cucumber', "1.1.2" 
    gem 'cucumber-rails', "1.2.0" 

    gem 'rspec-rails', "2.7.0" 

    gem 'spork', "0.9.0.rc9" 

    gem 'launchy' #launches the page 

    gem 'guard-spork', "0.3.1" 
    gem 'guard-rspec', "0.5.4" 
    gem 'guard-cucumber', "0.7.4" 

    gem 'factory_girl_rails' 
end 

내 Guardfile 두 그룹이있다.

group :specs do 

    guard :spork, :rspec_env => { 'RAILS_ENV' => 'test' } do 
    watch('config/application.rb') 
    watch('config/environment.rb') 
    watch(%r{^config/environments/.+\.rb$}) 
    watch(%r{^config/initializers/.+\.rb$}) 
    watch('spec/spec_helper.rb') 
    end 

    guard :rspec, :version => 2 do 
    watch(%r{^spec/.+_spec\.rb$}) 
    watch(%r{^lib/(.+)\.rb$})  { |m| "spec/lib/#{m[1]}_spec.rb" } 
    watch('spec/spec_helper.rb') { "spec" } 

    # # Rails example 
    watch(%r{^spec/.+_spec\.rb$}) 
    watch(%r{^app/(.+)\.rb$})       { |m| "spec/#{m[1]}_spec.rb" } 
    watch(%r{^lib/(.+)\.rb$})       { |m| "spec/lib/#{m[1]}_spec.rb" } 
    watch(%r{^app/controllers/(.+)_(controller)\.rb$}) { |m| ["spec/routing/#{m[1]}_routing_spec.rb", "spec/#{m[2]}s/#{m[1]}_#{m[2]}_spec.rb", "spec/acceptance/#{m[1]}_spec.rb"] } 
    watch(%r{^spec/support/(.+)\.rb$})     { "spec" } 
    watch('spec/spec_helper.rb')      { "spec" } 
    watch('config/routes.rb')       { "spec/routing" } 
    watch('app/controllers/application_controller.rb') { "spec/controllers" } 
    # Capybara request specs 
    watch(%r{^app/views/(.+)/.*\.(erb|haml)$})   { |m| "spec/requests/#{m[1]}_spec.rb" } 
    end 

end 

group :features do 

    guard 'spork', :cucumber_env => { 'RAILS_ENV' => 'test' } do 
    watch('config/application.rb') 
    watch('config/environment.rb') 
    watch(%r{^config/environments/.+\.rb$}) 
    watch(%r{^config/initializers/.+\.rb$}) 
    watch('spec/spec_helper.rb') 
    end 

    guard 'cucumber' do 
    watch(%r{^features/.+\.feature$}) 
    watch(%r{^features/support/.+$})   { 'features' } 
    watch(%r{^features/step_definitions/(.+)_steps\.rb$}) { |m| Dir[File.join("**/#{m[1]}.feature")][0] || 'features' } 
    end 

end 

: specs 그룹을 실행하려고하면 Guard가 Rspec에 대해서만 Spork를 실행하기를 기대합니다.

guard -g specs start 

그러나 출력 결과에서 가드가 Rspec과 Cucumber 모두에 대해 Spork를 실행한다는 것을 알 수 있습니다.

~/current[master]% guard -g specs start 
WARNING: You are using Guard outside of Bundler, this is dangerous and may not work. Using `bundle exec guard` is safer. 
Guard could not detect any of the supported notification libraries. 
Guard is now watching at '/Users/rupert/Desktop/cws-rails' 
Starting Spork for RSpec & Cucumber 
Using RSpec 
Using Cucumber 
Preloading Rails environment 
Preloading Rails environment 
Loading Spork.prefork block... 
Loading Spork.prefork block... 
Spork is ready and listening on 8990! 
Spork is ready and listening on 8989! 
Spork server for RSpec & Cucumber successfully started 
Guard::RSpec is running, with RSpec 2! 
Running all specs 

내가 놓친 SPORK 또는 가드의 구성 파일이 있습니까?

UPDATE :

  1. 가드 - 오이

  2. 제거를 제거하거나 이름 바꾸기 폴더를 특징

답변

6

당신은 RSpec에 그룹과 다른 방법으로 주위에 Spork에 오이를 해제해야합니다 :

specs :specs  
    guard :spork, :cucumber => false do 
    # ... 
    end 
end 

specs :features  
    guard 'spork', :rspec => false do 
    # ... 
    end 
end 
0

가 나는 오래된 건 알지만 나는 또한 지금이 문제를 통해 발견하고 그것을 알아 냈 : 나는 것을 깨달았다 커밋을 찾고 features/step_definitions/email_steps.rb

:

내가 하나 개의 파일로 내 프로젝트 내에서 features 하위 디렉토리를했다 이것은 rails_apps_composer : testing 프레임 워크에서 추가되었습니다.

그래서 : 하위 디렉토리 features 제거는

오이를 사용하려고 시도에서 spork을 방지 할 수 있습니다.

관련 문제