Re: [rspec-users] testing sessions

2012-03-04 Thread Zach Dennis
On Sun, Mar 4, 2012 at 4:46 PM, S Ahmed wrote: > great thanks. > > should a var created in a block be reachable outside the block? Nope, not unless you defined the variable outside of the block to start with. > > it "" do >   expect { session = Session...   }.not_to change(Session, :coun

Re: [rspec-users] testing sessions

2012-03-04 Thread S Ahmed
great thanks. should a var created in a block be reachable outside the block? it "" do expect { session = Session... }.not_to change(Session, :count) session.guid.should end I tried that but was a bit confused, whatever is in the expect block is isolated right? On Sun, Mar 4,

Re: [rspec-users] testing sessions

2012-03-04 Thread David Chelimsky
On Sun, Mar 4, 2012 at 7:40 AM, S Ahmed wrote: > I want to test if my sessions logic works. > > Session: >  id >  user_id > > When I create a new session, if there was a previous session row in the db > with user_id = xxx, it should delete it first, then create a new row. > > How could I test this

[rspec-users] testing sessions

2012-03-04 Thread S Ahmed
I want to test if my sessions logic works. Session: id user_id When I create a new session, if there was a previous session row in the db with user_id = xxx, it should delete it first, then create a new row. How could I test this scenerio? So far I have: require 'spec_helper' describe Sessi