[rspec-users] class variables different between spec and runtime?

Rick DeNatale rick.denatale at gmail.com
Mon Dec 28 08:24:58 EST 2009

On Mon, Dec 28, 2009 at 12:18 AM, Andrew Premdas <apremdas at gmail.com> wrote:
> 2009/12/22 Rick DeNatale <rick.denatale at gmail.com>

> Please explain why - thanks.

Because, classes and class variables aren't guaranteed to be persistent.

In development mode, classes can get reloaded, which wipes out class
(and class instance) variables.

In most deployment scenarios requests from a single user might be
handled by different processes, each with it's own state.

State that needs to be around between requests needs to be somewhere
persistent like the DB, or the session.

Rick DeNatale

Blog: http://talklikeaduck.denhaven2.com/
Twitter: http://twitter.com/RickDeNatale
WWR: http://www.workingwithrails.com/person/9021-rick-denatale
LinkedIn: http://www.linkedin.com/in/rickdenatale

More information about the rspec-users mailing list