2014-01-28 18 views
0

我的Guardfile中有三個以上的守護寶石。當我跑衛時,我想要一個特定的防護寶石被禁用,而不從Guardfile中移除它。我應該如何禁用它?我們如何禁用Guardfile中的守護寶石

我的下一個問題是,rspec在發現第一個錯誤時會停止運行測試。有沒有辦法一次運行所有rspec錯誤。

什麼是守衛寶石是必不可少的,容易實現?

我Guardfile

# A sample Guardfile 
# More info at https://github.com/guard/guard#readme 
guard 'migrate' do 
    watch(%r{^db/migrate/(\d+).+\.rb}) 
    watch('db/seeds.rb') 
end 

guard :annotate do 
    watch('db/schema.rb') 

    # Uncomment the following line if you also want to run annotate anytime 
    # a model file changes 
    watch('app/models/*.rb') 

    # Uncomment the following line if you are running routes annotation 
    # with the ":routes => true" option 
    watch('config/routes.rb') 
end 

guard :bundler do 
    watch('Gemfile') 
    # Uncomment next line if your Gemfile contains the `gemspec' command. 
    # watch(/^.+\.gemspec/) 
end 

guard :rspec 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{^app/(.+)\.rb$})       { |m| "spec/#{m[1]}_spec.rb" } 
    watch(%r{^app/(.*)(\.erb|\.haml|\.slim)$})   { |m| "spec/#{m[1]}#{m[2]}_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('config/routes.rb')       { "spec/routing" } 
    watch('app/controllers/application_controller.rb') { "spec/controllers" } 

    # Capybara features specs 
    watch(%r{^app/views/(.+)/.*\.(erb|haml|slim)$})  { |m| "spec/features/#{m[1]}_spec.rb" } 

    # Turnip features and steps 
    watch(%r{^spec/acceptance/(.+)\.feature$}) 
    watch(%r{^spec/acceptance/steps/(.+)_steps\.rb$}) { |m| Dir[File.join("**/#{m[1]}.feature")][0] || 'spec/acceptance' } 
end 

guard :rubocop do 
    watch(%r{.+\.rb$}) 
    watch(%r{(?:.+/)?\.rubocop\.yml$}) { |m| File.dirname(m[0]) } 
end 

### Guard::Sidekiq 
# available options: 
# - :verbose 
# - :queue (defaults to "default") can be an array 
# - :concurrency (defaults to 1) 
# - :timeout 
# - :environment (corresponds to RAILS_ENV for the Sidekiq worker) 
guard 'sidekiq', :environment => 'development' do 
    watch(%r{^workers/(.+)\.rb$}) 
end 

guard 'rails' do 
    watch('Gemfile.lock') 
    watch(%r{^(config|lib)/.*}) 
end 


# Sample guardfile block for Guard::Haml 
# You can use some options to change guard-haml configuration 
# output: 'public'     set output directory for compiled files 
# input: 'src'      set input directory with haml files 
# run_at_start: true     compile files when guard starts 
# notifications: true    send notifictions to Growl/libnotify/Notifu 
# haml_options: { ugly: true } pass options to the Haml engine 

guard 'puma' do 
    watch('Gemfile.lock') 
    watch(%r{^config|lib|api/.*}) 
end 

guard 'rake', :task => 'build' do 
    watch(%r{^my_file.rb}) 
end 
+0

你是什麼意思guardfile?顯示它 –

+0

在'guard'中重新運行'rspec'點擊輸入按鈕,但是你不應該在'Gemfile'中有多個'guard' – bjhaid

回答