New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
cucumber.rake should execute db:test:clone not test:prepare #278
Comments
@kramerdog I believe it makes more sense to use the test:clone instead of test:prepare. Would you like to make a pull request with your changes and see if everything works? |
Again this should be dependent on the Rails version I guess as this only I have fixed my immediate issue but wont be able to get to this for a while On Thu, Feb 27, 2014 at 2:22 AM, Kosmas Chatzimichalis <
|
@kramerdog are you using rspec too? rspec-rails seems to be using
@Kosmas it looks like rails are deprecating |
Hi Steve Maybe I am just confused about things because I dont use migrations. And I I use config.active_record.schema_format = :sql When I start a test run I want a copy of my development database schema "as Under Rails 4 the test:prepare task didnt appear to behave in this same way But it does seem to be the case that all the rake tasks have been changed On Fri, Feb 28, 2014 at 3:07 AM, Steve Tooke notifications@github.comwrote:
|
@tooky thanks! I think it makes more sense like that. I will have a look, but I believe that we should also change it and use the test:clone. |
@kramerdog looking at the tasks from rails 3.2 (here and here) you're right that it would dump the structure from development, then load that into test - but it would check for pending migrations. I believe that checking for pending migrations before running the tests has bee the expected behaviour in a rails project as long as I've used it. If you have migrations that haven't been run on your database then how can you be sure that your tests (that hit the DB) are passing or failing correctly? @Kosmas I think the best solution might be to add WDYT? |
Probably relevant: rails/rails#13528 and |
Apologies for dredging up a seriously old topic. But figured given we will drop rails 4 support soon for cucumber-rails (We only support 4.2 at the moment as a minimum), I was wondering if this is still an issue. I had a brief look into the things linked here, and from what tooky said about adding an additional task to the default is definitely not a problem. Is this something you would want? cc/ @kramerdog @joallard |
Yeah, it's been too long, I don't think this is relevant to me anymore. |
I'll keep monitoring this for a while then close if appropriate. |
As I just mentioned in $277 I did a
rails generate cucumber:install
on a new Rails 4 project today and couldnt work out why running rake cucumber didnt rebuild my test database
It took me ages to figure out but it seems that the Rails team have silently restructured the way that all of the Rake tasks work for cloning the structure of the development database to a freshly built test database.
From what I can tell the test:prepare task used to rebuild the test database. Now it appears from
...\lib\ruby\gems\2.0.0\gems\activerecord-4.0.3\lib\active_record\railties\databases.rake
that prepare is now only the task to 'Check for pending migrations and load the test schema'
I had to update all occurrences of test:prepare in cucumber.rake, such as in:
with db:test:clone to get rake cucumber to rebuild my test database prior to running mu cucumber features.
So shouldn't the cucumber.rake task generated now be using db:test:clone?
I should note that I am using
in application.rb
and also had to add the line to application.rb:
ActiveRecord::Base.schema_format = config.active_record.schema_format
as a workaround as ActiveRecord::Base.schema_format was still being evaluated as :ruby in the clone task of databases.rake and is supposed to evaluate as :sql as a result of my config setting
ruby 2.0.0p353
rails 4.0.3
cucumber 1.3.10
cucumber-rails 1.4.0
OS Win64
The text was updated successfully, but these errors were encountered: