[rspec-users] rspec hangs when used with QtRuby

Stefano Crocco stefano.crocco at alice.it
Sat Aug 25 09:50:19 EDT 2007


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 tried searching google, this mailing list's archives and QtRuby forum, but I 
found nothing about this. Am I doing something wrong or is it a RSpec or 
QtRuby problem? I'm asking here because I think it's caused by RSpec (or by 
my wrong use of it), since it happened when I upgraded RSpec. If the issue is 
related more to QtRuby than to RSpec, please let me know and I'll ask in the 
QtRuby forum.

Thanks in advance

Stefano


More information about the rspec-users mailing list