New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rspec not honoring tags (like :focus) when run in spork #166

Closed
skaufman opened this Issue Jan 11, 2012 · 11 comments

Comments

Projects
None yet
6 participants
@skaufman

skaufman commented Jan 11, 2012

Discussed more fully here:

http://groups.google.com/group/rubyonrails-talk/browse_thread/thread/a13fc86501c68a34?hl=en

When there are specs with examples tagged :focus => true, the following behavior is seen:

  • rspec run alone recognizes the tag and limits the tests to the tagged examples
  • rspec run within spork ignores the tag and runs all examples

This appears to be due to some new incompatibility between spork and rspec due to the recent update of rspec to 2.8.x.

@jfelchner

This comment has been minimized.

Show comment
Hide comment
@jfelchner

jfelchner Jan 12, 2012

I'm not sure here @thibaudgg, @timcharper everything works fine except when running through guard with Spork.

rspec my_spec.rb # including a filtered spec

^^^ Works

guard
Guard::RSpec is running, with RSpec 2!
Running: my_spec.rb

^^^ Works

guard
Starting Spork for RSpec
Using RSpec
Preloading Rails environment
Loading Spork.prefork block...
Spork is ready and listening on 8989!
Spork server for RSpec successfully started
Guard::RSpec is running, with RSpec 2!
Running: my_spec.rb

^^^ Does not work

Simply running the spec with only Spork running (no guard) also does not work.

I include a lot of files in the prefork block in spec_helper.

This file behaves as it should:

RSpec.configure do |config|
  # Configure RSpec to respect the alias 'pit' for pending specs
  config.alias_example_to :pit, :pending => true
end

This file does not:

RSpec.configure do |config|
  # Configure RSpec to run focused specs, and also respect the alias 'fit' for focused specs
  config.treat_symbols_as_metadata_keys_with_true_values = true
  config.filter_run       :focused => true
  config.alias_example_to :fit, :focused => true
  config.run_all_when_everything_filtered = true
end

All of this was working perfectly fine before the RSpec 2.8 upgrade.

jfelchner commented Jan 12, 2012

I'm not sure here @thibaudgg, @timcharper everything works fine except when running through guard with Spork.

rspec my_spec.rb # including a filtered spec

^^^ Works

guard
Guard::RSpec is running, with RSpec 2!
Running: my_spec.rb

^^^ Works

guard
Starting Spork for RSpec
Using RSpec
Preloading Rails environment
Loading Spork.prefork block...
Spork is ready and listening on 8989!
Spork server for RSpec successfully started
Guard::RSpec is running, with RSpec 2!
Running: my_spec.rb

^^^ Does not work

Simply running the spec with only Spork running (no guard) also does not work.

I include a lot of files in the prefork block in spec_helper.

This file behaves as it should:

RSpec.configure do |config|
  # Configure RSpec to respect the alias 'pit' for pending specs
  config.alias_example_to :pit, :pending => true
end

This file does not:

RSpec.configure do |config|
  # Configure RSpec to run focused specs, and also respect the alias 'fit' for focused specs
  config.treat_symbols_as_metadata_keys_with_true_values = true
  config.filter_run       :focused => true
  config.alias_example_to :fit, :focused => true
  config.run_all_when_everything_filtered = true
end

All of this was working perfectly fine before the RSpec 2.8 upgrade.

@SegFaultAX

This comment has been minimized.

Show comment
Hide comment
@SegFaultAX

SegFaultAX Jan 13, 2012

I'm seeing the exact behavior as above, except I'm using it to disable certain specs rather than focus execution via config.filter_run_excluding :disabled => true. Again, it only became an issue with the 2.8 update.

SegFaultAX commented Jan 13, 2012

I'm seeing the exact behavior as above, except I'm using it to disable certain specs rather than focus execution via config.filter_run_excluding :disabled => true. Again, it only became an issue with the 2.8 update.

@thibaudgg

This comment has been minimized.

Show comment
Hide comment
@thibaudgg

thibaudgg Jan 13, 2012

I think it's a issue with RSpec 2.8, have you try to add --tag disabled in your .rspec file?

thibaudgg commented Jan 13, 2012

I think it's a issue with RSpec 2.8, have you try to add --tag disabled in your .rspec file?

@raston

This comment has been minimized.

Show comment
Hide comment
@raston

raston Jan 13, 2012

I'm seeing this same problem since upgrading to RSpec 2.8. Adding --tag focus to .rspec is a good workaround and fixes the problem for now.

raston commented Jan 13, 2012

I'm seeing this same problem since upgrading to RSpec 2.8. Adding --tag focus to .rspec is a good workaround and fixes the problem for now.

@skaufman

This comment has been minimized.

Show comment
Hide comment
@skaufman

skaufman Jan 13, 2012

--tag focus added to .rspec indeed fixes this! Hurrah!

Since the problem turned out to be with rspec -- not spork -- after all, I'll close this issue here.

skaufman commented Jan 13, 2012

--tag focus added to .rspec indeed fixes this! Hurrah!

Since the problem turned out to be with rspec -- not spork -- after all, I'll close this issue here.

@skaufman skaufman closed this Jan 13, 2012

@jfelchner

This comment has been minimized.

Show comment
Hide comment
@jfelchner

jfelchner Jan 14, 2012

@skaufman can you leave this issue open until we hear from @timcharper or @dchelimsky on this? The fact that RSpec works correctly EXCEPT when Spork is running makes me think that it is a Spork issue, but I don't know enough about Spork OR RSpec to be sure.

@thibaudgg this is a decent workaround for now but even though it's the case that --tag focus to the .rspec file might "work", in my opinion, it is not the solution. For one, the .rspec file is a per-developer configuration and should not be checked into version control. Whereas a project-wide configuration should be.

jfelchner commented Jan 14, 2012

@skaufman can you leave this issue open until we hear from @timcharper or @dchelimsky on this? The fact that RSpec works correctly EXCEPT when Spork is running makes me think that it is a Spork issue, but I don't know enough about Spork OR RSpec to be sure.

@thibaudgg this is a decent workaround for now but even though it's the case that --tag focus to the .rspec file might "work", in my opinion, it is not the solution. For one, the .rspec file is a per-developer configuration and should not be checked into version control. Whereas a project-wide configuration should be.

@skaufman skaufman reopened this Jan 14, 2012

@thibaudgg

This comment has been minimized.

Show comment
Hide comment
@thibaudgg

thibaudgg Jan 14, 2012

@jfelchner I agree, this is only a temporary workaround.

thibaudgg commented Jan 14, 2012

@jfelchner I agree, this is only a temporary workaround.

@skaufman

This comment has been minimized.

Show comment
Hide comment

skaufman commented Jan 14, 2012

@jmuheim

This comment has been minimized.

Show comment
Hide comment
@jmuheim

jmuheim Mar 1, 2014

This seems to be still necessary (adding --tag focus to .rspec). Is there any update on this issue?

jmuheim commented Mar 1, 2014

This seems to be still necessary (adding --tag focus to .rspec). Is there any update on this issue?

@jfelchner

This comment has been minimized.

Show comment
Hide comment
@jfelchner

jfelchner May 27, 2018

@skaufman can we go ahead and close this out please?

jfelchner commented May 27, 2018

@skaufman can we go ahead and close this out please?

@skaufman skaufman closed this May 27, 2018

@skaufman

This comment has been minimized.

Show comment
Hide comment
@skaufman

skaufman May 28, 2018

skaufman commented May 28, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment