The Artima Developer Community
Sponsored Link

Ruby Buzz Forum
assert_cookie for ooey gooey fun

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
Brian Ford

Posts: 153
Nickname: brixen
Registered: Dec, 2005

Brian Ford is Rails developer with PLANET ARGON.
assert_cookie for ooey gooey fun Posted: Aug 27, 2006 2:43 PM
Reply to this message Reply

This post originated from an RSS feed registered with Ruby Buzz by Brian Ford.
Original Post: assert_cookie for ooey gooey fun
Feed Title: def euler(x); cos(x) + i*sin(x); end
Feed URL: http://feeds.feedburner.com/defeulerxcosxisinxend
Feed Description: euler(PI) # => -1
Latest Ruby Buzz Posts
Latest Ruby Buzz Posts by Brian Ford
Latest Posts From def euler(x); cos(x) + i*sin(x); end

Advertisement

I love cookies. There are, of course, tons of varieties and I’m no connoisseur but I love the soft chocolate chip right out of the oven, hot and gooey. But, if you’re like me, you don’t want your Rails code to be gooey.

Last Friday, after spending a good frustrating hour trying to figure out why my tests were failing with a nil when a cookie was expected, I finally tried a google search for “assert cookies”. (A lot of more detailed searches pulled up nothing but Java stuff, a not-so-subtle reminder that Ruby is not yet the dominant language out there.) Seems that Pluit Solutions ran into the same problem. This got me thinking that a nice custom assertion might be in order. Actually, I just wrote a quick helper because that was faster than trying to figure out why Rails wasn’t performing as advertised. But it kept bugging me, so I wrapped it up as a plugin. It’s still rough and tests are coming. Perhaps I’m putting too much into a single assertion. Install it from http://svn.planetargon.org/rails/plugins/assert_cookie. And please send feedback.

The idea is to allow various assertions about cookies using a hash of arguments. In particular, you can do such things as:


assert_cookie :pass, 
    :value => lambda { |value| UUID.parse(value).valid? }
assert_cookie :yellow, :value => ['sunny', 'days']
assert_cookie :delight, :value => 'yum'
assert_cookie :secret, :path => lambda { |path| path =~ /secret/ }, 
    :secure => true

Read: assert_cookie for ooey gooey fun

Topic: Ruby 1.8.5 released. What's new? Previous Topic   Next Topic Topic: How To Use the Flickr API With a Simple Ruby Script

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use