Forum: RSpec rake db:test:prepare and pending migrations

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
171ea139761951336b844e708d1547ab?d=identicon&s=25 James Byrne (byrnejb)
on 2009-04-07 19:42
(Received via mailing list)
I have run into a minor glitch and would like to know what others
think.  I am working on a test/expectation and as part of the
process of debugging I am rolling back db:migrations one step at a
time to discover where the problem was introduced.

My workflow looks like this:

$ cucumber ... feature:xx
fail
$ rake db:rollback
$ rake db:test:prepare
  fail ... you have pending migrations.

Now, it seems to me that while testing one is interested only in
those migrations that have been applied, not which ones are
available.  It is nice to be notified that unapplied migrations
exist but I am not sure that one should be constrained to apply them
to conduct tests.

What do others think?


--
***          E-Mail is NOT a SECURE channel          ***
James B. Byrne                mailto:ByrneJB@Harte-Lyne.ca
Harte & Lyne Limited          http://www.harte-lyne.ca
9 Brockley Drive              vox: +1 905 561 1241
Hamilton, Ontario             fax: +1 905 561 0757
Canada  L8E 3C3
369b9fd2a0d9e7cdbc60907a2a056ad9?d=identicon&s=25 Scott Taylor (Guest)
on 2009-04-07 19:46
(Received via mailing list)
On Apr 7, 2009, at 1:32 PM, James B. Byrne wrote:

> $ rake db:rollback
> $ rake db:test:prepare
>  fail ... you have pending migrations.
>
> Now, it seems to me that while testing one is interested only in
> those migrations that have been applied, not which ones are
> available.  It is nice to be notified that unapplied migrations
> exist but I am not sure that one should be constrained to apply them
> to conduct tests.
>
> What do others think?

If you are using git, it might be wiser to create a branch and reset --
hard back to those migrations.

Or, use git's bisect, and migrate:reset from a clean db each time

Scott
48641c4be1fbe167929fb16c9fd94990?d=identicon&s=25 Mark Wilden (Guest)
on 2009-04-07 20:42
(Received via mailing list)
On Tue, Apr 7, 2009 at 10:44 AM, Scott Taylor <scott@railsnewbie.com>
wrote:
>>
>> to conduct tests.
>>
>> What do others think?
>
> If you are using git, it might be wiser to create a branch and reset --hard
> back to those migrations.
>
> Or, use git's bisect, and migrate:reset from a clean db each time


This also might be useful:
http://outofti.me/post/90028018/rake-db-rollback-to-common
39100495c9937c39b2e0c704444e1b4a?d=identicon&s=25 Pat Maddox (Guest)
on 2009-04-08 04:22
(Received via mailing list)
On Tue, Apr 7, 2009 at 10:32 AM, James B. Byrne <byrnejb@harte-lyne.ca>
wrote:
> $ rake db:rollback
>
> rspec-users mailing list
> rspec-users@rubyforge.org
> http://rubyforge.org/mailman/listinfo/rspec-users
>

Scott and Mark have given good input.  This is a Rails thing, not an
RSpec thing, so if you want the behavior of db:test:prepare changed
then you'll have to do it at the Rails end.

Pat
This topic is locked and can not be replied to.