[rspec-users] Module instance variable remains set

Harm harmaarts at gmail.com
Mon Feb 22 14:49:07 EST 2010

Addendum: I'm using rspec 1.3.0, rspec-rails 1.3.2 and ruby 1.9.1p129

On Feb 22, 8:45 pm, Harm <harmaa... at gmail.com> wrote:
> Hi,
> I have an issue with rSpec when spec'ing a module. The module in
> question looks like this:
> module Sheep
>   def self.sound
>     @sound ||= produce_sound()
>   end
> end
> This module is used all around the application (and corresponding
> specs) and somehow values of @sound leak between each spec. The only
> way I found to fix it is to manually set the instance variable (with
> instance_variable_set) to nil. Obviously this is Bad. Is there a way
> to do this globally or better yet to prevent this?
> With kind regards,
> Harm
> _______________________________________________
> rspec-users mailing list
> rspec-us... at rubyforge.orghttp://rubyforge.org/mailman/listinfo/rspec-users

More information about the rspec-users mailing list