should set_session.to block argument

10 views
Skip to first unread message

Curran

unread,
Mar 4, 2011, 6:46:16 PM3/4/11
to shoulda
Hi,

I just upgraded to 2.11.3 from 2.10, and I'm having a bit of trouble
figuring out how to update one of my tests.

It used to read

should_set_session(:user) {@user.id}

The block wasn't evaluated till the test ran.

Now I'm trying to figure out how to pass a block into to(value=nil,
&block):

should set_session(:user).to(nil, ???)

I keep getting syntax errors. I'm sure it's simple, but can someone
please clue me in? None of the following are valid replacements
for ???:

{@user.id}
{|x| @user.id}
do @user.id end

Yes this is basic Ruby syntax, not a shoulda bug, but an example of
correct usage in the shoulda docs would help *immensely* for those
upgrading to the new matchers.

Thanks,
Curran

Curran Schiefelbein

unread,
Mar 5, 2011, 12:45:39 PM3/5/11
to shoulda
Of course. It should say:

    should set_session(:user).to(nil) {@user.id}

Curran



--
Individuals over processes. Interactions over tools.

Agile Rails training from thoughtbot, the makers of Clearance, Shoulda, & Factory Girl:
http://thoughtbot.com/services/training

The Shoulda group:
http://groups.google.com/group/shoulda

To post to this group, send email to
sho...@googlegroups.com

To unsubscribe from this group, send email to
shoulda+u...@googlegroups.com

Reply all
Reply to author
Forward
0 new messages