[rspec-users] when using command line -l, why do tests from other describe blocks run?

Mike Mazur mmazur at gmail.com
Tue Jan 11 18:09:36 EST 2011


Hi,

On Wed, Jan 12, 2011 at 02:32, Lille <lille.penguini at gmail.com> wrote:
> I frequently use the -l option to run only tests of interest, but it's
> messy in a way I don't understand...
>
> describe SomeModel do
>
>  describe "#some_method" do
>
>     it... # let's call this line 20
>
>  end
>
>  describe "#some_other_method" do
>
>    it... # here's some other test
>
>  end
>
> end
>
> If I enter 'spec -l 20 spec/models/some_model_spec.rb' on the command
> line, I get my line 20 test and others -- say the other test, above --
> why?

I think that's because line 20 is contained within another group (ie:
inside  describe "#some_method" do), so all examples from this group
are run.

Try running your tests with -l 21 (ie: the first line contained within
the it of the test you want to run); that should run only that test.

Mike


More information about the rspec-users mailing list