[rspec-users] rspec hangs when used with QtRuby

Scott Taylor mailing_lists at railsnewbie.com
Sat Aug 25 16:17:13 EDT 2007

On Aug 25, 2007, at 9:50 AM, Stefano Crocco wrote:

> Hello to everyone
> I'm having trouble using RSpec to test code which uses QtRuby (both  
> version 3
> and 4).
> I noticed that, after upgrading from RSpec 1.0.5 to RSpec 1.0.8,  
> some of my
> specs which used QtRuby caused spec (or rake, when used from a  
> Rakefile) to
> hang indefinitly. After a bit of investigation, I found that the  
> problem
> arose in the following situation:
> * requiring Qt4 / Qt3
> * creating a stub which stubs a method called :type
> What I found particulary strange is that this happens even if I  
> don't actually
> use Qt in the spec (directly or not). The following is the simplest  
> example I
> could write which reproduces the problem:
>   require 'Qt4'
>   describe 'something' do
>     it 'should work passing the :type parameter' do
>       s = stub('x', :type => 'anything')
>     end
>   end
> If I remove the first line, spec exits correctly with the message  
> "1 example,
> 0 failures". With the first line, instead, it hangs, and I have to  
> press
> Ctrl+C to make it go on (of course, in this case it says: "1  
> example, 1
> failure"). If I use another mock framework (I tried with flexmock),  
> then
> everythings works. If I replace :type with anything else in the  
> call to stub,
> then everything works.

I'm not sure which stubbing framework you are using when you aren't  
using flexmock, but I believe that if you are using RSpec's default  
mock/stubbing framework, the standard stubbing method is "stub!", not  
"stub", although this should still raise an error.  I would suggest  
adding relevant version numbers (of Ruby, Qt, RSpec (gem or trunk),  
platform, OS), and submitting a bug report on Rubyforge's database if  
no one gets back to you on this one.


More information about the rspec-users mailing list