[rspec-users] Run cucumber on a different DB than test?

Scott Taylor scott at railsnewbie.com
Fri Feb 27 12:02:48 EST 2009


On Feb 27, 2009, at 12:01 PM, Matt Wynne wrote:

>
> On 27 Feb 2009, at 16:54, Scott Taylor wrote:
>
>>
>> On Feb 27, 2009, at 11:41 AM, Matt Wynne wrote:
>>
>>>
>>> On 26 Feb 2009, at 18:27, Scott Taylor wrote:
>>>
>>>>
>>>> On Feb 26, 2009, at 1:19 PM, Forrest Chang wrote:
>>>>
>>>>> Hi all:
>>>>>
>>>>> Is it possible to run Rails Cucumber spec in a different DB than  
>>>>> the test DB?  I'd like to run the rspec and cucumber tests in  
>>>>> parallel in my cc.rb build, and as it is now, I get MYSQL  
>>>>> deadlocks on occasion.  I could serialize them, but I'd like the  
>>>>> quicker feedback of running them in parallel.
>>>>
>>>> Why not create a new environment, and set  
>>>> RAILS_ENV="test_cucumber" ?
>>>>
>>>> Scott
>>>>
>>>
>>> We do this, and it's entirely possible, in fact I highly recommend  
>>> it. We call our environment 'features'
>>>
>>> One gotcha is that rspec-rails and a certain file in rails[1]  
>>> (which cucumber requires into Cucumber::Rails::World) will stomp  
>>> all over your RAILS_ENV and set it back to 'test', which means  
>>> that if you do (and you really shouldn't) have any code that  
>>> depends on this being set correctly, it will break.
>>
>> Yeah, and certain rake tasks won't work, if I recall properly.   
>> RAILS_ENV=another_env rake db:test:prepare still reset the test  
>> database, not the db in another_env.
>>
>> Scott
>
> Indeed. I do have a fully-functioning rake db:features:prepare task  
> which I can share if anyone's interested.
>
> It's kind of a shame - this aspect of Rails is not nearly so  
> extensible as it looks. I really should spend some effort pushing  
> them some patches instead of just bodging it in our codebase.

Of course one of the issues is that they *do* want to provide checks  
for certain tasks.

You'd probably want an error RAILS_ENV=development rake db:test:prepare

Scott

>
>
>
> Matt Wynne
> http://blog.mattwynne.net
> http://www.songkick.com
>
> _______________________________________________
> rspec-users mailing list
> rspec-users at rubyforge.org
> http://rubyforge.org/mailman/listinfo/rspec-users



More information about the rspec-users mailing list