RSpec: How do I reload the environment?

T

Thomas Watson

Hi

I'm writing a series of RSpec tests for a Rails plugin. In some of
these tests I use meta-programming (using class_eval) to change core
features of my environment. But these changes to the environment also
affect the following tests that come after. Is there a way to reload
the environment either before or after a certain test has run, or
maybe before or after a certain spec file?

/thomas
 
D

dan yoder

Hi Thomas,

You can use Autocode for that. You mixin Autoload into the module(s)
that you want to reload, specify which directories you want to load
files from for that module, and then just call reload. This will
actually remove anything that was autoloaded from memory (different
than simply reloading it, which can sometimes leave artifacts) and
then reload it the next time it's referenced.

Main page:
http://dev.zeraweb.com/autoload/

HTH,
Dan
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Members online

Forum statistics

Threads
473,780
Messages
2,569,611
Members
45,265
Latest member
TodLarocca

Latest Threads

Top