Unexpected behaviors with --profile #1112

Closed
inkstak opened this Issue Oct 15, 2013 · 7 comments

4 participants

@inkstak

Hi,

I have strange behaviors with the --profile option, when I try to run only one spec.
I use Rspec 2.14.1 with a Rails app (4.0.0).

Cases 1 - My default case, I have a .rspec file with --profile in it

Running rspec ./spec/models/ufo_spec.rb:42works fine.
Running the same command with Spork will launch the whole tests suite.

Before that, I'll get the following warning:
Non integer specified as profile count, seperate your path from options with -- e.g. 'rspec --profile -- ./spec/models/ufo_spec.rb:42'

Cases 2 - --profile removed from .rspec, without Spork

Running rspec ./spec/models/ufo_spec.rb:42 works fine, without profiling.
Running it with --profile warns me and launch the whole tests suite.
Running it with --profile 0 works fine.

Cases 3 - --profile removed from .rspec, with Spork

Running rspec ./spec/models/ufo_spec.rb:42 works fine, without profiling.
Running it with --profile warns me and launch the whole tests suite.
Running it with --profile 0 warns me and launch the whole tests suite.

For both last cases, Spork run tests with args ["--color", "--profile"]

@JonRowe
RSpec member

Hmm I suspect this is being interpreted either by us or by spork as rspec --profile ./spec/models/ufo_spec.rb:42 which is correctly breaking.

Try sticking a -- after the --profile in your .rspec to indicate you do want no argument.

@inkstak

Running rspec --profile -- ./spec/models/ufo_spec.rb:42
Spork is ignoring --and still running tests with args ["--color", "--profile", "./spec/models/ufo_spec.rb:42"]

@inkstak

I started digging into Spork & Rspec-core. Drb arguments are sent by rspec-core:
/lib/rspec/core/drb_options.rb#L14
/lib/rspec/core/configuration_options.rb#L40
/lib/rspec/core/drb_command_line.rb#L22

Maybe we can use something like that at line 14:

argv << "--profile=#{ @submitted_options[:profile_examples] }" if @submitted_options[:profile_examples]

I guess it'll be better to use the configuration.profile_examples but it's not accessible from DrbOptions, at this point.

@myronmarston
RSpec member

This has gotten stale. Closing, but if others run into this we can reopen.

@smojtabai

I am running into this issue as well, I can't seem to have profile in my .rspec file and get it to read in the file name correctly.

@myronmarston
RSpec member

@smojtabai, can you open a fresh issue with repro steps?

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