[rspec-users] Sqlite3, in-memory db and rspec_server

Scott Taylor mailing_lists at railsnewbie.com
Thu Jun 21 14:33:43 EDT 2007


On Jun 21, 2007, at 1:32 PM, Ed Howland wrote:

> Hi everyone.
>
> I can't get the above(subject line) combination to work. If I use a
> standard sqlite3 file db for the test db, and spec_server all the
> specs on my models pass. If I use an in-memory db for the test db,
> script/spec w/o spec_server, they all pass. But if I use in-memory and
> spec_server I get the following error:
> 1)
> ActiveRecord::StatementInvalid in 'User should be valid'
> ActiveRecord::StatementInvalid
> ./spec/models/user_spec.rb:5:in `new'
> ./spec/models/user_spec.rb:5:
> ./script/spec_server:23:in `run'
> ./script/spec_server:44:
>
> Line 5 is the User.new in the before clause.
>
> I have tried this on various versions of things. RSpec 1.0.5, Ubuntu
> 6.04, Rails 1.2.3,  Sqlite 3.2.8, sqlit3-ruby 1.2.1 (gem)
> And on Ubuntu 7.04, Sqlite 3.3.13
>
> Same results.
> Any ideas?

I've had the same problem before, even using the in-memory plugin (by  
Geoffrey Grosenbach).

If my memory serves me right,  I believe that something like the  
following is going on: the DRB server performs certain actions (like  
creating the test database schema) only once.  Normally the test  
database schema would be recreated after every Test::Unit class /  
RSpec Behavior.  Since the database schema isn't recreated when using  
the drb server, the in memory database no longer exists (go figure)  
after a bit (say, after the first few specs), and Rails throws an  
exception.

I'd be interesting in seeing a full trace. Maybe we can get to the  
bottom of this bug.

Best,

Scott



More information about the rspec-users mailing list