rack-devel archive mirror (unofficial) https://groups.google.com/group/rack-devel
 help / color / mirror / Atom feed
From: Eric Wong <normalperson@yhbt.net>
To: rack-devel@googlegroups.com
Subject: [PATCH] make Rack::Session::Cookie spec immune to Marshal changes
Date: Thu, 31 Dec 2009 12:19:29 -0800	[thread overview]
Message-ID: <20091231201929.GA25849@dcvr.yhbt.net> (raw)
In-Reply-To: <e064621a0912310215g2cf25d60k309ffc5e04f38b11@mail.gmail.com>

Various versions/implementations of Ruby may Marshal data
differently.  Instead of relying on a fragile test that
relies on exact byte sequence matches, just rely on existing
round-trip tests for the cookies.
---
  Christian Neukirchen <chneukirchen@gmail.com> wrote:
  > On Thu, Dec 31, 2009 at 2:37 AM, Eric Wong <normalperson@yhbt.net> wrote:
  > >  Otoh, I feel this test is so fragile that it's probably best to
  > >  scrap it and rely on the round-trip tests...
  > 
  > +1

  This patch squashes the previous one in this thread.

  Pushed out to the "mri-1.9.2dev" branch of git://git.bogomips.org/rack
  http://git.bogomips.org/cgit/rack.git/commit/?h=mri-1.9.2dev

 test/spec_rack_session_cookie.rb |    6 +-----
 1 files changed, 1 insertions(+), 5 deletions(-)

diff --git a/test/spec_rack_session_cookie.rb b/test/spec_rack_session_cookie.rb
index 3be88b4..a164789 100644
--- a/test/spec_rack_session_cookie.rb
+++ b/test/spec_rack_session_cookie.rb
@@ -49,11 +49,7 @@ context "Rack::Session::Cookie" do
   
   specify "creates a new cookie with integrity hash" do
     res = Rack::MockRequest.new(Rack::Session::Cookie.new(incrementor, :secret => 'test')).get("/")
-    if RUBY_VERSION < "1.9"
-      res["Set-Cookie"].should.match("rack.session=BAh7BiIMY291bnRlcmkG%0A--1439b4d37b9d4b04c603848382f712d6fcd31088")
-    else
-      res["Set-Cookie"].should.match("rack.session=BAh7BkkiDGNvdW50ZXIGOg1lbmNvZGluZyINVVMtQVNDSUlpBg%3D%3D%0A--d7a6637b94d2728194a96c18484e1f7ed9074a83")
-    end
+    res["Set-Cookie"].should.match("rack.session=")
   end
   
   specify "loads from a cookie wih integrity hash" do
-- 
Eric Wong

      reply	other threads:[~2009-12-31 20:19 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-12-31  1:37 [PATCH] make Rack::Session::Cookie spec pass under 1.9.2dev Eric Wong
2009-12-31 10:15 ` Christian Neukirchen
2009-12-31 20:19   ` Eric Wong [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://groups.google.com/group/rack-devel

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20091231201929.GA25849@dcvr.yhbt.net \
    --to=rack-devel@googlegroups.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).