[rspec-users] Help: Attempts to run specs quitting midstream

Matt Wynne matt at mattwynne.net
Tue Nov 18 14:44:27 EST 2008


On 18 Nov 2008, at 17:06, Matt Griffith wrote:
> Evan Dorn wrote:
>> I am having a very frustrating problem running specs on my current
>> project.  When I run tests en masse with "rake spec" or with  
>> autotest,
>> it frequently quits without completing all the tests.   It also
>> sometimes runs the tests in multiple batches, giving more than one
>> result line for a single batch of tests.
>
> I was having a similar problem. My specs would quit running after a
> third of them ran. When I ran my specs using ./script/spec spec I'd  
> get
> a different count and my specs would run as two batches.
>
> I decided to run each of my specs separately using something like:
>
> ruby script/spec "spec/controllers/name_of_a_specific_spec.rb"
>
> That showed that some of my specs were in fact failing. If I tried to
> run ./script/specs with any options I'd get a report of:
>
> 0 examples, 0 failures
>
> Then I decided to run each directory under spec/* separately so I  
> could
> try to narrow down which specs were causing the problem. I ran:
>
> ./script/spec spec/controllers
> ./script/spec spec/models
> ./script/spec spec/views
>
> When I ran views I got the same "0 examples, 0 failures" message so I
> ran each folder separately:
>
> ./script/spec spec/views/view_1
> ./script/spec spec/views/view_2
>
> That let me narrow it down to specific views that were causing the
> problem. Then I ran each spec separately.
>
> My problem was caused by using
> template.should_receive(:current_user).and_return(@user). Commenting
> that out fixed RSpec for me. I can now run it using rake spec or even
> rake spec:rcov and it works the same as running ./script/spec spec.
>
> Hope that helps. I'm still not sure why RSpec is failing this way.

It would be really helpful if you could file a bug report so that  
people can get onto fixing it:
http://rspec.lighthouseapp.com/projects/5645-rspec/tickets/new

cheers,
Matt


More information about the rspec-users mailing list