[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

RSpec: How do I reload the environment?

Thomas Watson

1/13/2008 12:57:00 PM

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
3 Answers

Dan Yoder

1/14/2008 4:54:00 PM

0

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...

HTH,
Dan

On Jan 13, 4:56 am, Thomas Watson <w...@tson.dk> wrote:
> 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

Thomas Watson

1/15/2008 10:10:00 PM

0

On Jan 14, 5:54 pm, dan yoder <d...@zeraweb.com> wrote:
> Main page:http://dev.zeraweb.com...

Hi dan...

Great :) But it seems that the server has problems... I get a 500,
trying to load the URL.

Junkone

1/16/2008 1:03:00 AM

0

On Jan 15, 5:10 pm, Thomas Watson <w...@tson.dk> wrote:
> On Jan 14, 5:54 pm, dan yoder <d...@zeraweb.com> wrote:
>
> > Main page:http://dev.zeraweb.com...
>
> Hi dan...
>
> Great :) But it seems that the server has problems... I get a 500,
> trying to load the URL.

i see the same error too.