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

Re: [rspec-users] what RSpec approach could I use for this.

2012-03-04 Thread David Chelimsky
On Sat, Mar 3, 2012 at 4:29 PM, Justin Ko wrote: > > On Mar 3, 2012, at 2:55 PM, Greg C. wrote: > >> Background:  So I have roughly: >> >> class A >>   def calculate_input_datetimes >>      # do stuff to calculate datetimes - then for each one identified >>      process_datetimes(my_datetime_start

[rspec-users] Request for comments: additional new expectation syntax

2012-03-04 Thread Myron Marston
I've opened a pull request with an initial implementation of using `expect` to set normal expectations in addition to block ones: expect(something).to be_awesome Note that it's not simply the syntax change that's driving the possibility of introducing this. It's the fact that the `should` and `s