Closed fullofcaffeine closed 14 years ago
Ok. I can see how this could be a problem. But I'm afraid the solution wouldn't be just moving the specs to a directory other than /spec
. The real problem here is that steak sits on top of rspec and, as you mention, it uses the rspec environment for its own configuration. Moving the specs to a different directory wouldn't change this fact.
RSpec has mechanisms to create isolated environments for different types of specs (e.g. in controller specs, there are methods available like get
, post
... which are not available in the model specs). I think that would probably be the best and simple way to solve this issue.
As for the suggestion of moving the specs to another directory, since this problem can be solved without doing it, I still don't see compelling reasons to do it.
I keep this issue open. Patches welcomed.
Hi Luismi,
I see acceptance tests as a superset of rspec unit tests. So, the spec-helper usually doesn't cause any issues for me (i.e it doesn't load or set up anything that would break Steak acceptance tests), but loading acceptance_helper while running unit-tests do cause wreak-havoc, as I explained.
I'm sure there are other ways to layout the tests and that other people might come with more flexible and elegant solutions. I just went through the way I knew -- mimicked Cucumber's approach (isolating them from rspec tests, when running).
It is working fine for me so far -- when I want to run my unit-tests, I use the spec task. When I want to run acceptance tests, I run spec:acceptance.
I'm, of course, open for new ideas or better ways to make it work, I'll be also eventually be contributing patches if I find something that's worth sharing.
Cheers!
Marcelo.
This just started biting us as we started using selenium with capybara and had to turn off transactional_fixtures in acceptance_helper.rb, but it's on in spec_helper.rb
You may find this useful: http://www.ruby-forum.com/topic/211577
Thanks for that cavalle, that makes sense and I was doing the exact same thing: using database_cleaner with truncation in acceptance_helper and use_transactional_fixtures=true in spec_helper.
I wonder if it's something worth mentioning in the README?
Set metadata type attribute to :acceptance so that helper modules and hooks can be set exclusively for acceptance specs without contaminating other specs in the suite. Closed by 5d3a1e976caaf3ad58ff90942febb57f4cdc5f08
For additional discussion about the problem and the solution implemented see: http://groups.google.com/group/steakrb/t/28fa2b843e0239fd
Hello,
First of all, great work with Steak ;)
Now, I'm having some issues with Steak and the rake spec task. Rake spec is running all the specs under spec/, including Steak acceptance tests. This wouldn't be much of an issue if acceptance tests weren't:
So, the biggest issue is when acceptance_helper is loaded and hence steak helpers are too (from spec/steak/support) - They wreak havoc with rSpec environment (I have a helper file that sets up DatabaseCleaner, but this is supposed to run only for acceptance tests) and other non-accetpance tests fail.
I think the generator should create the Steak directory on RAILS_ROOT, maybe RAILS_ROOT/acceptance, just like Cucumber does to keep things isolated (want it or not, acceptance tests are a different beast).
Thanks,
Marcelo.