[rspec-users] How does Spork help in requests specs?
Rodrigo Rosenfeld Rosas
lbocseg at yahoo.com.br
Fri May 18 00:45:24 UTC 2012
Indeed, deleting the tables manually requires more effort because of the
foreign keys that will require a specific order, but the specs got way
faster than using truncation. Go figure it out.
And worse than that is reading this on PG documentation:
"TRUNCATE quickly removes all rows from a set of tables. It has the same
effect as an unqualified DELETE on each table, but*since it does not
actually scan the tables it is faster*."
Yeah, sure, I believed on you once. Maybe this is true for large tables,
but not so true for testing matters.
I just found that I should report this here for benefits of others that
might consider this approach as well on PostgreSQL.
Em 17-05-2012 21:09, Rodrigo Rosenfeld Rosas escreveu:
> Sorry about this, I'm further investigating the slowness issue, and I
> found the culprit: truncation of my PostgreSQL are very slow. I'll
> investigate how to make it faster. Maybe deletion could be faster than
> truncation on PG...
> Em 17-05-2012 21:04, Rodrigo Rosenfeld Rosas escreveu:
>> Even with Spork, my requests specs are very slow to start running
>> (about 7 seconds).
>> I suspect Rails is booting each time I run "rspec -X spec/requests".
>> Is that true? If so, is there any way I could instruct the web server
>> to keep alive after the specs run so that it would be faster on next
>> Are there any resources on how to have better performance on running
>> requests specs with Capybara and Webkit?
>> Having to wait about 7 seconds between consecutive runs is really a
>> blocker for me. If I can't get it to run faster, I'll give up on
>> requests specs and only have the controller's tests and client-side
>> code specs without any integration tests...
>> But to be honest, I feel much more comfortable having some
>> integration tests for the main features of my application and I would
>> appreciate any hints on making them start faster.
>> The last time I worked with Rails, long ago, it wasn't such a painful
>> experience to write such kind of tests (Capybara + Webkit). And my
>> current desktop PC is *way* faster than it used to be by that time...
>> I understand that Rails is much slower to boot now, but maybe there
>> are some tricks for reducing the need of rebooting between
>> consecutive requests specs run.
>> Thanks in advance,
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the rspec-users