On Thursday, January 9, 2014 6:37:01 AM UTC-8, Rodrigo Rosenfeld Rosas 
wrote:
>
> I'm struggling with an issue with one of my tests which not require the 
> full Rails environment... 
>
> When looking at the full statements log, I can only see a single BEGIN 
> line and no COMMIT statement, only a ROLLBACK in the end. And there are 
> no INSERT statements outside the BEGIN-ROLLBACK block. But after running 
> a single test I can see that the database is no longer empty and I have 
> to recreate it... 
>
> If I replace spec_db_only_helper with spec_helper, which loads the full 
> Rails environment, it works for some reason. I can't understand this. 
>
> Another difference is that I get several SELECT NULL; statements when 
> using spec_db_only_helper while they don't show up with spec_helper.rb. 
>
> There's a single connection in the pool for the test environment. 
>
> Also, I had to call save_changes with transaction: false in my 
> factory-girl Model.save! implementation otherwise it would generate some 
> BEGIN-COMMIT blocks inside a DB.transaction(savepoint: true, rollback: 
> :always){} block. 
>
> Any ideas what could be happening here? 
>

My guess would be problems with your environment.  If BEGIN-COMMIT are 
being issued inside a DB.transaction block, and you don't have sharding 
enabled and aren't using threads, my only guess is that the model's 
database doesn't match DB.  The SELECT NULL statements only showing up with 
spec_db_only_helper and not with spec_helper also indicates that two 
different Database objects may be in play.  Is Sequel::DATABASES the same 
when using both helpers?

Thanks,
Jeremy

-- 
You received this message because you are subscribed to the Google Groups 
"sequel-talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sequel-talk.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to