Hi Dan

Thanks for your help. I was nearly there, but adding

  Rails::DataMapper.preload_models(MyApp::Application)

to the each_run block was not enough. Changing the name of a method in
a model class was still not recognized, all tests executed on the old
version of the model.

Then I googled again and found a hint to add

  ActiveSupport::Dependencies.clear

to the RSpec.configure block. That finally did the trick :-)

--
Gernot

On 8 Mrz., 16:33, "Dan Kubb (dkubb)" <[email protected]> wrote:
> Hi Gernot,
>
> > To speed up the execution of my specs I would like to use spork.
> > Unfortunately, Datamapper preloads all models at startup. Therefore, I
> > have to restart spork whenever I change a model.
>
> > Is there a way to disable model preloading or can I preload the models
> > on reach test run using the prefork configuration of spork?
>
> Here's an example of what I usually do in Rails 3 w/DataMapper and
> Spork:
>
>  http://pastie.org/1647636
>
> I've also found that using guard and guard-spork is a really nice way
> to manage the spork process and setup a modern autotest-like
> environment. The DSL to configure which specs are executed is much
> nicer than autotest, and you can configure other tasks to run when
> specific files are updated too. In my Gemfile I have something like
> this:
>
>   group :development do
>     gem 'rb-fsevent',    '~> 0.3.10'  # OSX only
>     gem 'growl',         '~> 1.0.3'
>     gem 'guard',         '~> 0.3.0'
>     gem 'guard-bundler', '~> 0.1.2'
>     gem 'guard-ego',     '~> 0.0.1'
>     gem 'guard-rspec',   '~> 0.1.9'
>     gem 'guard-spork',   '~> 0.1.4'
>   end
>
> Be sure to read the guard documentation on how to setup and configure
> it.. it's pretty easy, but you do have to configure a few things that
> you might not normally have to deal with (i.e. like adding --drb to
> the rspec config options).
>
> --
>
> Dan
> (dkubb)

-- 
You received this message because you are subscribed to the Google Groups 
"DataMapper" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/datamapper?hl=en.

Reply via email to