[rspec-users] Rspec error while running jruby -S rake spec

Chandu80 chandu.shenoy at gmail.com
Thu Sep 15 03:54:51 EDT 2011


Hi David,
So does that mean that I need to manually delete all other tables for
the rake command to run successfully?


Regards
Chandrika

On Sep 13, 11:32 am, David Chelimsky <dchelim... at gmail.com> wrote:
> On Sep 12, 2011, at 2:44 PM, Chandu80 wrote:
>
>
>
> > Hello All,
>
> > I followed steps to install Rspec as in the link pasted below.
>
> >http://www.pmamediagroup.com/2009/04/tutorial-install-rspec-rails-fac...
>
> > I have jRuby on Rails installed on my machine.Hence all commands need
> > to be run with jruby -S extension.
> > However when I run the jruby -S rake spec command,I get the following
> > error as shown below.
>
> > ************************************************************************************************************************
> > C:\Rspec Test>jruby -S rake spec --trace
> > (in C:/Rspec Test)
> > ** Invoke spec (first_time)
> > ** Invoke db:test:prepare (first_time)
> > ** Invoke db:abort_if_pending_migrations (first_time)
> > ** Invoke environment (first_time)
> > ** Execute environment
> > db pool warmup starting...................... Mon Sep 12 18:05:23
> > +0530 2011
>
> > warmed
> > up...........===========================================..............
>
> > db pool warmup done........................... Mon Sep 12 18:05:23
> > +0530 2011
>
> > ** Execute db:abort_if_pending_migrations
> > ** Execute db:test:prepare
> > ** Invoke db:test:load (first_time)
> > ** Invoke db:test:purge (first_time)
> > ** Invoke environment
> > ** Execute db:test:purge
> > RspecTest already exists
> > ** Execute db:test:load
> > ** Invoke db:schema:load (first_time)
> > ** Invoke environment
> > ** Execute db:schema:load
>
> When you run a spec suite, RSpec delegates to Rails to do the same work it does before and after a test suite. One task it runs is db:schema:load, which is defined in Rails. It asks the configured database for a list of tables and then tries to drop and recreate them. This ensures that any data from a previous run is removed, and the schema for the test db matches that of the development db.
>
>
>
> > rake aborted!
> > ActiveRecord::ActiveRecordError: ERROR: cannot drop table channels
> > because other
> > objects depend on it
> >  Detail: constraint messages_channel_id_fk on table messages depends
> > on table c
> > hannels
> > constraint invitation_workflow_mapping_invitor on table
> > invitation_workflows dep
> > ends on table channels
> > constraint invitation_workflow_mapping_invited_whom_id on table
> > invitation_workf
> > lows depends on table channels
> > constraint invitation_workflow_mapping_invited_for_channel_id on table
> > invitatio
> > n_workflows depends on table channels
> >  Hint: Use DROP ... CASCADE to drop the dependent objects too.: DROP
> > TABLE "cha
> > nnels"
>
> <snip/>
>
> > What does the error indicate,I tried commenting all lines having
> > drop_database statement in them.
> > Another thing is that the database already has tables and by using the
> > tutorial I have just added another table for the bank-account.
> > Kindly let me know what exactly needs to be done in this case
>
> The message tells you the underlying problem: there are database constraints that are not allowing the tables to be deleted in the order in which the rake task is trying to delete them. For whatever reason, the active record adapter you are using is not invoking a cascading delete. What adapter are you using? What database? Also, what other db-related gems do you have in the app? Just type `jruby -S bundle show`.
> _______________________________________________
> rspec-users mailing list
> rspec-us... at rubyforge.orghttp://rubyforge.org/mailman/listinfo/rspec-users


More information about the rspec-users mailing list