[rspec-users] RSpec-Rails not tearing down the session?

Brian Cardarella bcardarella at gmail.com
Wed Oct 28 08:35:43 EDT 2009


So the problem I was having was because I had a before_filter that was
disabling the magic states for a specific action. I resolved the
problem by changing this to an around filter:

before:

def disable_magic_states
   UserSession.disable_magic_states = true
end

after:

def temporarily_disable_magic_states
   UserSession.disable_magic_states = true
   yield
   UserSession.disable_magic_states = false
end

That fixed it. Kind of a unique problem but if it hopefully it will
save somebody else some time.

- Brian

On Oct 28, 12:19 am, Brian Cardarella <bcardare... at gmail.com> wrote:
> So I think that this is an Authlogic issue, not a RSpec-Rails issue.
> I'll keep digging and if I find a fix I'll update
>
> On Oct 27, 10:53 pm, Brian Cardarella <bcardare... at gmail.com> wrote:
>
>
>
> > I've isolated the code pretty well. The session is being set with
> > Authlogic, not certain if that makes a difference.
>
> > The session hash is empty on the test side but populated in the
> > controller when it shouldn't be.
>
> > On Oct 27, 10:45 pm, David Chelimsky <dchelim... at gmail.com> wrote:> On Oct 27, 2009, at 9:39 PM, Brian Cardarella <bcardare... at gmail.com>  
> > > wrote:
>
> > > > I noticed that a session that I am setting up in one exa,ple is still
> > > > available in another. Is RSpec-Rails supposed to tear down the session
> > > > or should I be doing this myself?
>
> > > Unless you've got a before(:all) block, you should be getting a fresh  
> > > session in each example, in which case you've probably uncovered a bug.
> > > _______________________________________________
> > > rspec-users mailing list
> > > rspec-us... at rubyforge.orghttp://rubyforge.org/mailman/listinfo/rspec-users
>
> > _______________________________________________
> > rspec-users mailing list
> > rspec-us... at rubyforge.orghttp://rubyforge.org/mailman/listinfo/rspec-users
>
> _______________________________________________
> rspec-users mailing list
> rspec-us... at rubyforge.orghttp://rubyforge.org/mailman/listinfo/rspec-users


More information about the rspec-users mailing list