I have done this in my spec file:

RSpec.configure do |config|
  config_file = YAML.load_file('settingsyml')['test']
  #DataMapper::Logger.new($stdout, :debug)
  DataMapper.setup(:default, config_file['db_url'])
  DataMapper.finalize
  DataMapper::Model.raise_on_save_failure = true

  
#--------------------------------------------------------------------------------------------#
  # Flush all tables before each test and enter some default values #
  
#--------------------------------------------------------------------------------------------#
  config.before(:each) {
    DataMapper.auto_migrate!
    # Seed tables here
  }

And this in my Rakefile:

    require 'rspec/core/rake_task'
    RSpec::Core::RakeTask.new(:spec)

So, whenever i do:

    $ rake spec

It automigrates the db and seeds it and executes the specs

On Mon, May 20, 2013 at 3:39 AM,  <datamapper@googlegroups.com> wrote:
>   Today's Topic Summary
>
> Group: http://groups.google.com/group/datamapper/topics
>
> Datamapper autoupgrade for test db [1 Update]
>
>  Datamapper autoupgrade for test db
>
> Akshay Khole <aks...@reversehack.in> May 18 10:01PM -0700
>
> How can I run an autoupgrade for my test database to contain my schema
> before running my specs ?
>
> Currently I do not see a rake task doing that.
>
> Am I missing something?
>
>
>
> You received this message because you are subscribed to the Google Group
> datamapper.
> You can post via email.
> To unsubscribe from this group, send an empty message.
> For more options, visit this group.
>
> --
> You received this message because you are subscribed to the Google Groups
> "DataMapper" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to datamapper+unsubscr...@googlegroups.com.
> To post to this group, send email to datamapper@googlegroups.com.
> Visit this group at http://groups.google.com/group/datamapper?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"DataMapper" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to datamapper+unsubscr...@googlegroups.com.
To post to this group, send email to datamapper@googlegroups.com.
Visit this group at http://groups.google.com/group/datamapper?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to