Hi Trying to get rcov going (has been working), but with the following context and specs it fails. context ''/account POST with invalid attendee'' do controller_name :account setup do Attendee.stub!(:create!).and_raise(ActiveRecord::RecordInvalid.new( Attendee.new)) end specify ''should raise on create'' do Attendee.should_receive(:create!).with({ ''name'' => ''Attendee'' }).and_raise(ActiveRecord::RecordInvalid.new(Attendee.new)) post :create, :attendee => { :name => ''Attendee'' } end specify ''should render new'' do controller.should_render :action => ''new'' post :create end end All I get is /usr/lib/ruby/gems/1.8/gems/rspec-0.7.5/lib/spec/mocks/error_generator.rb:53: [BUG] Segmentation fault I tried variations on the specs and setup, but it fails when only running the should render new spec and everything else commented out. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/rspec-users/attachments/20070109/039ad785/attachment.html
Le 9 janv. 07 ? 11:37, Dylan Egan a ?crit :> Hi > > Trying to get rcov going (has been working), but with the following > context and specs it fails....> All I get is /usr/lib/ruby/gems/1.8/gems/rspec-0.7.5/lib/spec/mocks/ > error_generator.rb:53: [BUG] Segmentation faultI get the same error but only on my MacbookPro and only when using mock_model (cf: http://www.dzone.com/rsslinks/ making_a_mockery_of_activerecord.html). The same code running on a debian server (ruby 1.8.5-4, rspec 0.7.5, rcov 0.7.0.1, Rails 1.2RC) don''t produce the error... But I get failed specs I did not get on my MacbookPro (I''m using Cerberus for CI) Really weird... Jonathan -- Tron Jonathan http://jonathan.tron.name
Le 9 janv. 07 ? 11:58, Jonathan Tron a ?crit :> Le 9 janv. 07 ? 11:37, Dylan Egan a ?crit : > >> Hi >> >> Trying to get rcov going (has been working), but with the following >> context and specs it fails. > ... >> All I get is /usr/lib/ruby/gems/1.8/gems/rspec-0.7.5/lib/spec/mocks/ >> error_generator.rb:53: [BUG] Segmentation fault > > I get the same error but only on my MacbookPro and only when using > mock_model (cf: http://www.dzone.com/rsslinks/ > making_a_mockery_of_activerecord.html). > The same code running on a debian server (ruby 1.8.5-4, rspec 0.7.5, > rcov 0.7.0.1, Rails 1.2RC) don''t produce the error... But I get > failed specs I did not get on my MacbookPro (I''m using Cerberus for > CI)I just find the problem with different rspec results between my two configuration... I use sqlite3 as test database and for a reason I ignore, the rake task db:test:prepare seems to cause ActiveRecord to pre-populate some of my models with quotes (''''). My specs on presence_of validations then just failed. If I do a db:migrate / db:test:clone_structure and then run specs the errors vanished... Jonathan -- Tron Jonathan http://jonathan.tron.name
On 1/9/07, Jonathan Tron <jonathan.tron.mailings at gmail.com> wrote:> Le 9 janv. 07 ? 11:37, Dylan Egan a ?crit : > > > Hi > > > > Trying to get rcov going (has been working), but with the following > > context and specs it fails. > ... > > All I get is /usr/lib/ruby/gems/1.8/gems/rspec-0.7.5/lib/spec/mocks/ > > error_generator.rb:53: [BUG] Segmentation fault > > I get the same error but only on my MacbookPro and only when using > mock_model (cf: http://www.dzone.com/rsslinks/ > making_a_mockery_of_activerecord.html). > The same code running on a debian server (ruby 1.8.5-4, rspec 0.7.5, > rcov 0.7.0.1, Rails 1.2RC) don''t produce the error... But I get > failed specs I did not get on my MacbookPro (I''m using Cerberus for CI) > > Really weird...I was having similar problems on an MBP when I was using sqlite and rails. Since I started always using mysql, no problem. What was really weird was that I could get rid of the error by simply adding a few blank lines to any file that was involved in the spec run. VERY weird.> > Jonathan > -- > Tron Jonathan > http://jonathan.tron.name > > > > _______________________________________________ > rspec-users mailing list > rspec-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users >
Le 9 janv. 07 ? 15:36, David Chelimsky a ?crit :> I was having similar problems on an MBP when I was using sqlite and > rails. Since I started always using mysql, no problem. > > What was really weird was that I could get rid of the error by simply > adding a few blank lines to any file that was involved in the spec > run. VERY weird.That''s exactly what I did after replying, I switched to MySQL (then to PostgreSQL ;) ) and all errors vanished. Besides these errors, the true (compared to sqlite''s one) foreign key implementation of both Mysql/PostgreSQL forced me to refactor my spec on vanilla model separating more appropriatly what should be tested with and without fixtures loaded and what should hit the db and what should not :)... (mock with randomly generated id is BAD!!!!! when your db check for foreign keys infringement). Jonathan -- Tron Jonathan http://jonathan.tron.name
Tried both suggestions. I moved from sqlite to postgresql. I also added some blank lines to the spec file, but without any luck. Will try and get it working somehow. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/rspec-users/attachments/20070110/52a9d0d2/attachment.html
Le 10 janv. 07 ? 00:07, Dylan Egan a ?crit :> Tried both suggestions. I moved from sqlite to postgresql. > > I also added some blank lines to the spec file, but without any luck. > > Will try and get it working somehow.Sorry about the confusion, mysql/postgresql solutions was related to the fact that some specs doesn''t work on sqlite3 when used in a different system. My problem of seg fault when using rcov and mock_model remains unsolved (on my MacbookPro), I think it''s a bug in ruby or rcov but I don''t really have time to track it down. Jonathan -- Tron Jonathan http://jonathan.tron.name