Fernando Perez wrote:
I am missing something here. Using PostgreSQL, when I remove this line
from the rake task, I don't see the DB being populated although I do
invoke create! on some models.

When I use debug(@some_instance) I see its id gets increased, so there
is definitely some data already in the DB.

Why can't I see anything in the DB? Is it possible to mock models so
that the rake features doesn't have to recreate the test DB each time to
speed things up?

I believe this can be explained by transactions. Cucumber wraps it's scenarios in ActiveRecord transactions (when in a rails app.) Most DBs by default will not allow you to see data that has been inserted until the transaction is committed. You may disable the transactions if you wish by commenting out the following line in env.rb:
Cucumber::Rails.use_transactional_fixtures

If you want to place data in your DB before cucumber is ran you could consider Zach's suggestion here:
http://www.continuousthinking.com/2008/7/17/using-seed-data-with-rspec-stories

I am interested in replacing controller specs by webrat features. I
prefer the webrat's black box approach more for testing controllers and
views.

Would it be possible to have autotest trigger "rake features"?
The latest version of cucumber (master from github-- not released yet) currently does it. But that default behavior might change in the future. (Reason being is that cucumber features are application level tests and may be too slow for the regular red->green->refactor cycle that autotest/autospec offers.)

-Ben
_______________________________________________
rspec-users mailing list
rspec-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/rspec-users

Reply via email to