Dabrorius
Dabrorius

Reputation: 1039

Skipping specific rspec tests in guard

I'm trying to get the guard to skip some tests (those that require selenium to run). I've added browser_required tag to them and running rspec with "--tag ~browser_required" filters them out.

However I can't get guard not to run them, I've set :cli => "--tag ~browser_required" in guardfile. This is my full guard file http://pastebin.com/pGuWAQm8

Upvotes: 2

Views: 756

Answers (3)

dpaluy
dpaluy

Reputation: 3705

The cli option is deprecated in Rspec 3. Use cmd instead. For example:

guard :rspec, cmd: "bundle exec rspec --color --tag ~speed:slow", failed_mode: :focus do
  require "guard/rspec/dsl"
  dsl = Guard::RSpec::Dsl.new(self)

  # RSpec files
  rspec = dsl.rspec
  watch(rspec.spec_helper) { rspec.spec_dir }
  watch(rspec.spec_support) { rspec.spec_dir }
  watch(rspec.spec_files)

  watch(%r{\Aapp/(.+)\.rb\z})   { |m| "spec/#{m[1]}_spec.rb" }
end

Read more on Rspec tags here

Upvotes: 0

luacassus
luacassus

Reputation: 6720

Check my config: https://github.com/lucassus/locomotive/blob/master/Guardfile You could pass cli arguments to rspec command and using --filter options you could reject some specs

guard 'rspec', :version => 2, :cli => "--drb --color --tag ~slow:true" {}

In your example you can use --tag ~js:true

Upvotes: 0

pjammer
pjammer

Reputation: 9577

In your gist it does have two rspec blocks (one with cli and another without). Perhaps deleting the second one will at least get this working.

Upvotes: 1

Related Questions