[DRE-commits] [ruby-cookiejar] 02/03: Added upstream patch for RSpec 3 (Closes: #795781)

Jonas Genannt genannt at moszumanska.debian.org
Wed Aug 19 10:29:59 UTC 2015


This is an automated email from the git hooks/post-receive script.

genannt pushed a commit to branch master
in repository ruby-cookiejar.

commit ef242614c73afe46e26bc41605686b01dcbe0554
Author: Jonas Genannt <jonas at brachium-system.net>
Date:   Wed Aug 19 12:31:59 2015 +0200

    Added upstream patch for RSpec 3 (Closes: #795781)
---
 debian/patches/rspec299.patch | 109 +++++++
 debian/patches/rspec3.patch   | 724 ++++++++++++++++++++++++++++++++++++++++++
 debian/patches/series         |   2 +
 3 files changed, 835 insertions(+)

diff --git a/debian/patches/rspec299.patch b/debian/patches/rspec299.patch
new file mode 100644
index 0000000..4d94057
--- /dev/null
+++ b/debian/patches/rspec299.patch
@@ -0,0 +1,109 @@
+From 60893dfad70d5a410621ee8ceed39845929870cd Mon Sep 17 00:00:00 2001
+From: David Waite <david at alkaline-solutions.com>
+Date: Thu, 17 Jul 2014 00:08:07 -0600
+Subject: [PATCH] Updated to rspec 2.99
+Bug: https://github.com/dwaite/cookiejar/commit/60893dfad70d5a410621ee8ceed39845929870cd.patch
+
+diff --git a/spec/cookie_spec.rb b/spec/cookie_spec.rb
+index 515b75f..dcd2acd 100644
+--- a/spec/cookie_spec.rb
++++ b/spec/cookie_spec.rb
+@@ -1,5 +1,4 @@
+-require 'cookiejar'
+-require 'rubygems'
++require 'spec_helper'
+ 
+ include CookieJar
+ 
+@@ -41,7 +40,7 @@
+     it "should accept secure cookies" do
+       cookie = Cookie.from_set_cookie 'https://www.google.com/a/blah', 'GALX=RgmSftjnbPM;Path=/a/;Secure'
+       cookie.name.should == 'GALX'
+-      cookie.secure.should be_true
++      cookie.secure.should be_truthy
+     end
+   end
+   describe "#from_set_cookie2" do
+@@ -62,7 +61,7 @@
+       cookie = Cookie.from_set_cookie2 'https://www.google.com/a/blah', 'GALX=RgmSftjnbPM;Path="/a/";Secure;Version=1'
+       cookie.name.should == 'GALX'
+       cookie.path.should == '/a/'
+-      cookie.secure.should be_true
++      cookie.secure.should be_truthy
+     end
+     it "should fail on unquoted paths" do
+       lambda do 
+@@ -141,8 +140,8 @@
+   describe '#should_send?' do
+     it "should not send if ports do not match" do
+       cookie = Cookie.from_set_cookie2 'http://localhost/', 'f=b;Version=1;Port="80"'
+-      cookie.should_send?("http://localhost/", false).should be_true
+-      cookie.should_send?("https://localhost/", false).should be_false
++      cookie.should_send?("http://localhost/", false).should be_truthy
++      cookie.should_send?("https://localhost/", false).should be_falsey
+     end
+   end
+   begin
+diff --git a/spec/cookie_validation_spec.rb b/spec/cookie_validation_spec.rb
+index b66fbdd..3d0f841 100644
+--- a/spec/cookie_validation_spec.rb
++++ b/spec/cookie_validation_spec.rb
+@@ -1,5 +1,4 @@
+-require 'cookiejar'
+-require 'rubygems'
++require 'spec_helper'
+ 
+ include CookieJar
+ describe CookieValidation do
+@@ -56,23 +55,23 @@
+     end
+     it "should handle a normal implicit internet cookie" do
+       normal = Cookie.from_set_cookie 'http://foo.com/', 'foo=bar'
+-      CookieValidation.validate_cookie('http://foo.com/', normal).should be_true
++      CookieValidation.validate_cookie('http://foo.com/', normal).should be_truthy
+     end
+     it "should handle a normal implicit localhost cookie" do
+       localhost = Cookie.from_set_cookie 'http://localhost/', 'foo=bar'
+-      CookieValidation.validate_cookie('http://localhost/', localhost).should be_true
++      CookieValidation.validate_cookie('http://localhost/', localhost).should be_truthy
+     end
+     it "should handle an implicit IP address cookie" do
+       ipaddr =  Cookie.from_set_cookie 'http://127.0.0.1/', 'foo=bar'
+-      CookieValidation.validate_cookie('http://127.0.0.1/', ipaddr).should be_true
++      CookieValidation.validate_cookie('http://127.0.0.1/', ipaddr).should be_truthy
+     end
+     it "should handle an explicit domain on an internet site" do
+       explicit = Cookie.from_set_cookie 'http://foo.com/', 'foo=bar;domain=.foo.com'
+-      CookieValidation.validate_cookie('http://foo.com/', explicit).should be_true
++      CookieValidation.validate_cookie('http://foo.com/', explicit).should be_truthy
+     end
+     it "should handle setting a cookie explicitly on a superdomain" do
+       superdomain = Cookie.from_set_cookie 'http://auth.foo.com/', 'foo=bar;domain=.foo.com'
+-      CookieValidation.validate_cookie('http://foo.com/', superdomain).should be_true
++      CookieValidation.validate_cookie('http://foo.com/', superdomain).should be_truthy
+     end
+     it "should handle explicitly setting a cookie" do
+       explicit = Cookie.from_set_cookie 'http://foo.com/bar/', 'foo=bar;path=/bar/'
+diff --git a/spec/jar_spec.rb b/spec/jar_spec.rb
+index 19d0b4e..e570624 100644
+--- a/spec/jar_spec.rb
++++ b/spec/jar_spec.rb
+@@ -1,6 +1,4 @@
+-require 'cookiejar'
+-require 'yaml'
+-require 'rubygems'
++require 'spec_helper'
+ 
+ include CookieJar
+ 
+diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb
+new file mode 100644
+index 0000000..ed6be3c
+--- /dev/null
++++ b/spec/spec_helper.rb
+@@ -0,0 +1,5 @@
++require 'cookiejar'
++require 'rubygems'
++require 'rspec'
++require 'rspec/collection_matchers'
++require 'yaml'
diff --git a/debian/patches/rspec3.patch b/debian/patches/rspec3.patch
new file mode 100644
index 0000000..92ce2db
--- /dev/null
+++ b/debian/patches/rspec3.patch
@@ -0,0 +1,724 @@
+From 80604ebc4d9bda071c1d34a2aba86b7aba56f2bd Mon Sep 17 00:00:00 2001
+From: David Waite <david at alkaline-solutions.com>
+Date: Thu, 17 Jul 2014 11:30:34 -0600
+Subject: [PATCH] upgrade to rspec 3
+Bug: https://github.com/dwaite/cookiejar/commit/80604ebc4d9bda071c1d34a2aba86b7aba56f2bd.patch
+
+diff --git a/spec/cookie_spec.rb b/spec/cookie_spec.rb
+index dcd2acd..1aba724 100644
+--- a/spec/cookie_spec.rb
++++ b/spec/cookie_spec.rb
+@@ -26,122 +26,122 @@
+     end
+     it "should give back the input names and values" do
+       cookie = Cookie.from_set_cookie 'http://localhost/', 'foo=bar'
+-      cookie.name.should == 'foo'
+-      cookie.value.should == 'bar'
++      expect(cookie.name).to eq 'foo'
++      expect(cookie.value).to eq 'bar'
+     end
+     it "should normalize domain names" do
+       cookie = Cookie.from_set_cookie 'http://localhost/', 'foo=Bar;domain=LoCaLHoSt.local'
+-      cookie.domain.should == '.localhost.local'
++      expect(cookie.domain).to eq '.localhost.local'
+     end
+     it "should accept non-normalized .local" do
+       cookie = Cookie.from_set_cookie 'http://localhost/', 'foo=bar;domain=.local'
+-      cookie.domain.should == '.local'
++      expect(cookie.domain).to eq '.local'
+     end
+     it "should accept secure cookies" do
+       cookie = Cookie.from_set_cookie 'https://www.google.com/a/blah', 'GALX=RgmSftjnbPM;Path=/a/;Secure'
+-      cookie.name.should == 'GALX'
+-      cookie.secure.should be_truthy
++      expect(cookie.name).to eq 'GALX'
++      expect(cookie.secure).to be_truthy
+     end
+   end
+   describe "#from_set_cookie2" do
+     it "should give back the input names and values" do
+       cookie = Cookie.from_set_cookie2 'http://localhost/', 'foo=bar;Version=1'
+-      cookie.name.should == 'foo'
+-      cookie.value.should == 'bar'
++      expect(cookie.name).to eq 'foo'
++      expect(cookie.value).to eq 'bar'
+     end
+     it "should normalize domain names" do
+       cookie = Cookie.from_set_cookie2 'http://localhost/', 'foo=Bar;domain=LoCaLHoSt.local;Version=1'
+-      cookie.domain.should == '.localhost.local'
++      expect(cookie.domain).to eq '.localhost.local'
+     end
+     it "should accept non-normalized .local" do
+       cookie = Cookie.from_set_cookie2 'http://localhost/', 'foo=bar;domain=.local;Version=1'
+-      cookie.domain.should == '.local'
++      expect(cookie.domain).to eq '.local'
+     end
+     it "should accept secure cookies" do
+       cookie = Cookie.from_set_cookie2 'https://www.google.com/a/blah', 'GALX=RgmSftjnbPM;Path="/a/";Secure;Version=1'
+-      cookie.name.should == 'GALX'
+-      cookie.path.should == '/a/'
+-      cookie.secure.should be_truthy
++      expect(cookie.name).to eq 'GALX'
++      expect(cookie.path).to eq  '/a/'
++      expect(cookie.secure).to be_truthy
+     end
+     it "should fail on unquoted paths" do
+-      lambda do 
++      expect(lambda do 
+         Cookie.from_set_cookie2 'https://www.google.com/a/blah', 
+           'GALX=RgmSftjnbPM;Path=/a/;Secure;Version=1'
+-      end.should raise_error InvalidCookieError
++      end).to raise_error InvalidCookieError
+     end
+     it "should accept quoted values" do
+       cookie = Cookie.from_set_cookie2 'http://localhost/', 'foo="bar";Version=1'
+-      cookie.name.should == 'foo'
+-      cookie.value.should == '"bar"'
++      expect(cookie.name).to eq 'foo'
++      expect(cookie.value).to eq '"bar"'
+     end
+     it "should accept poorly chosen names" do
+       cookie = Cookie.from_set_cookie2 'http://localhost/', 'Version=mine;Version=1'
+-      cookie.name.should == 'Version'
+-      cookie.value.should == 'mine'
++      expect(cookie.name).to eq 'Version'
++      expect(cookie.value).to eq 'mine'
+     end
+     it "should accept quoted parameter values" do
+       cookie = Cookie.from_set_cookie2 'http://localhost/', 'foo=bar;Version="1"'
+     end
+     it "should honor the discard and max-age parameters" do
+       cookie = Cookie.from_set_cookie2 'http://localhost/', 'f=b;max-age=100;discard;Version=1'
+-      cookie.should be_session
+-      cookie.should_not be_expired
++      expect(cookie).to be_session
++      expect(cookie).to_not be_expired
+       
+       cookie = Cookie.from_set_cookie2 'http://localhost/', 'f=b;max-age=100;Version=1'
+-      cookie.should_not be_session
++      expect(cookie).to_not be_session
+ 
+       cookie = Cookie.from_set_cookie2 'http://localhost/', 'f=b;Version=1'
+-      cookie.should be_session
++      expect(cookie).to be_session
+     end
+     it "should handle quotable quotes" do
+       cookie = Cookie.from_set_cookie2 'http://localhost/', 'f="\"";Version=1'
+-      cookie.value.should eql '"\""'
++      expect(cookie.value).to eq '"\""'
+     end
+     it "should handle quotable apostrophes" do
+       cookie = Cookie.from_set_cookie2 'http://localhost/', 'f="\;";Version=1'
+-      cookie.value.should eql '"\;"'
++      expect(cookie.value).to eq '"\;"'
+     end
+   end
+   describe '#decoded_value' do
+     it "should leave normal values alone" do
+       cookie = Cookie.from_set_cookie2 'http://localhost/', 'f=b;Version=1'
+-      cookie.decoded_value.should eql 'b'
++      expect(cookie.decoded_value).to eq 'b'
+     end
+     it "should attempt to unencode quoted values" do
+       cookie = Cookie.from_set_cookie2 'http://localhost/', 'f="\"b";Version=1'
+-      cookie.value.should eql '"\"b"'
+-      cookie.decoded_value.should eql '"b'
++      expect(cookie.value).to eq '"\"b"'
++      expect(cookie.decoded_value).to eq '"b'
+     end
+   end
+   describe '#to_s' do
+     it "should handle a simple cookie" do
+       cookie = Cookie.from_set_cookie 'http://localhost/', 'f=b'
+-      cookie.to_s.should == 'f=b'
+-      cookie.to_s(1).should == '$Version=0;f=b;$Path="/"'
++      expect(cookie.to_s).to eq 'f=b'
++      expect(cookie.to_s(1)).to eq '$Version=0;f=b;$Path="/"'
+     end
+     it "should report an explicit domain" do
+       cookie = Cookie.from_set_cookie2 'http://localhost/', 'f=b;Version=1;Domain=.local'
+-      cookie.to_s(1).should == '$Version=1;f=b;$Path="/";$Domain=.local'
++      expect(cookie.to_s(1)).to eq '$Version=1;f=b;$Path="/";$Domain=.local'
+     end
+     it "should return specified ports" do
+       cookie = Cookie.from_set_cookie2 'http://localhost/', 'f=b;Version=1;Port="80,443"'
+-      cookie.to_s(1).should == '$Version=1;f=b;$Path="/";$Port="80,443"'
++      expect(cookie.to_s(1)).to eq '$Version=1;f=b;$Path="/";$Port="80,443"'
+     end
+     it "should handle specified paths" do
+       cookie = Cookie.from_set_cookie 'http://localhost/bar/', 'f=b;path=/bar/'
+-      cookie.to_s.should == 'f=b'
+-      cookie.to_s(1).should == '$Version=0;f=b;$Path="/bar/"'
++      expect(cookie.to_s).to eq 'f=b'
++      expect(cookie.to_s(1)).to eq '$Version=0;f=b;$Path="/bar/"'
+     end
+     it "should omit $Version header when asked" do
+       cookie = Cookie.from_set_cookie 'http://localhost/', 'f=b'
+-      cookie.to_s(1,false).should == 'f=b;$Path="/"'
++      expect(cookie.to_s(1,false)).to eq 'f=b;$Path="/"'
+     end
+   end
+   describe '#should_send?' do
+     it "should not send if ports do not match" do
+       cookie = Cookie.from_set_cookie2 'http://localhost/', 'f=b;Version=1;Port="80"'
+-      cookie.should_send?("http://localhost/", false).should be_truthy
+-      cookie.should_send?("https://localhost/", false).should be_falsey
++      expect(cookie.should_send?("http://localhost/", false)).to be_truthy
++      expect(cookie.should_send?("https://localhost/", false)).to be_falsey
+     end
+   end
+   begin
+@@ -150,7 +150,7 @@
+       it "should serialize a cookie to JSON" do
+         c = Cookie.from_set_cookie 'https://localhost/', 'foo=bar;secure;expires=Fri, September 11 2009 18:10:00 -0700'
+         json = c.to_json
+-        json.should be_a String
++        expect(json).to be_a String
+       end
+     end
+     describe ".json_create" do
+@@ -163,7 +163,7 @@
+       it "should automatically deserialize to a cookie" do
+         json = "{\"json_class\":\"CookieJar::Cookie\",\"name\":\"foo\",\"value\":\"bar\",\"domain\":\"localhost.local\",\"path\":\"\\/\",\"created_at\":\"2009-09-11 12:51:03 -0600\",\"expiry\":\"2009-09-11 19:10:00 -0600\",\"secure\":true}" 
+         c = JSON.parse json, :create_additions => true
+-        c.should be_a Cookie
++        expect(c).to be_a Cookie
+         CookieValidation.validate_cookie 'https://localhost/', c
+       end
+     end
+diff --git a/spec/cookie_validation_spec.rb b/spec/cookie_validation_spec.rb
+index 3d0f841..b65d2a2 100644
+--- a/spec/cookie_validation_spec.rb
++++ b/spec/cookie_validation_spec.rb
+@@ -5,73 +5,73 @@
+   describe "#validate_cookie" do
+     localaddr = 'http://localhost/foo/bar/'
+     it "should fail if version unset" do
+-      lambda do
++      expect(lambda do
+         unversioned = Cookie.from_set_cookie localaddr, 'foo=bar'
+         unversioned.instance_variable_set :@version, nil
+         CookieValidation.validate_cookie localaddr, unversioned
+-      end.should raise_error InvalidCookieError
++      end).to raise_error InvalidCookieError
+     end
+     it "should fail if the path is more specific" do
+-      lambda do
++      expect(lambda do
+         subdirred = Cookie.from_set_cookie localaddr, 'foo=bar;path=/foo/bar/baz'
+         # validate_cookie localaddr, subdirred
+-      end.should raise_error InvalidCookieError
++      end).to raise_error InvalidCookieError
+     end
+     it "should fail if the path is different than the request" do
+-      lambda do
++      expect(lambda do
+         difdirred = Cookie.from_set_cookie localaddr, 'foo=bar;path=/baz/'
+         # validate_cookie localaddr, difdirred
+-      end.should raise_error InvalidCookieError
++      end).to raise_error InvalidCookieError
+     end
+     it "should fail if the domain has no dots" do
+-      lambda do
++      expect(lambda do
+         nodot = Cookie.from_set_cookie 'http://zero/', 'foo=bar;domain=zero'
+         # validate_cookie 'http://zero/', nodot
+-      end.should raise_error InvalidCookieError
++      end).to raise_error InvalidCookieError
+     end
+     it "should fail for explicit localhost" do
+-      lambda do
++      expect(lambda do
+         localhost = Cookie.from_set_cookie localaddr, 'foo=bar;domain=localhost'
+         # validate_cookie localaddr, localhost
+-      end.should raise_error InvalidCookieError
++      end).to raise_error InvalidCookieError
+     end
+     it "should fail for mismatched domains" do
+-      lambda do
++      expect(lambda do
+         foobar = Cookie.from_set_cookie 'http://www.foo.com/', 'foo=bar;domain=bar.com'
+         # validate_cookie 'http://www.foo.com/', foobar
+-      end.should raise_error InvalidCookieError
++      end).to raise_error InvalidCookieError
+     end
+     it "should fail for domains more than one level up" do
+-      lambda do
++      expect(lambda do
+         xyz = Cookie.from_set_cookie 'http://x.y.z.com/', 'foo=bar;domain=z.com'
+         # validate_cookie 'http://x.y.z.com/', xyz
+-      end.should raise_error InvalidCookieError
++      end).to raise_error InvalidCookieError
+     end
+     it "should fail for setting subdomain cookies" do
+-      lambda do
++      expect(lambda do
+         subdomain = Cookie.from_set_cookie 'http://foo.com/', 'foo=bar;domain=auth.foo.com'
+         # validate_cookie 'http://foo.com/', subdomain
+-      end.should raise_error InvalidCookieError
++      end).to raise_error InvalidCookieError
+     end
+     it "should handle a normal implicit internet cookie" do
+       normal = Cookie.from_set_cookie 'http://foo.com/', 'foo=bar'
+-      CookieValidation.validate_cookie('http://foo.com/', normal).should be_truthy
++      expect(CookieValidation.validate_cookie('http://foo.com/', normal)).to be_truthy
+     end
+     it "should handle a normal implicit localhost cookie" do
+       localhost = Cookie.from_set_cookie 'http://localhost/', 'foo=bar'
+-      CookieValidation.validate_cookie('http://localhost/', localhost).should be_truthy
++      expect(CookieValidation.validate_cookie('http://localhost/', localhost)).to be_truthy
+     end
+     it "should handle an implicit IP address cookie" do
+       ipaddr =  Cookie.from_set_cookie 'http://127.0.0.1/', 'foo=bar'
+-      CookieValidation.validate_cookie('http://127.0.0.1/', ipaddr).should be_truthy
++      expect(CookieValidation.validate_cookie('http://127.0.0.1/', ipaddr)).to be_truthy
+     end
+     it "should handle an explicit domain on an internet site" do
+       explicit = Cookie.from_set_cookie 'http://foo.com/', 'foo=bar;domain=.foo.com'
+-      CookieValidation.validate_cookie('http://foo.com/', explicit).should be_truthy
++      expect(CookieValidation.validate_cookie('http://foo.com/', explicit)).to be_truthy
+     end
+     it "should handle setting a cookie explicitly on a superdomain" do
+       superdomain = Cookie.from_set_cookie 'http://auth.foo.com/', 'foo=bar;domain=.foo.com'
+-      CookieValidation.validate_cookie('http://foo.com/', superdomain).should be_truthy
++      expect(CookieValidation.validate_cookie('http://foo.com/', superdomain)).to be_truthy
+     end
+     it "should handle explicitly setting a cookie" do
+       explicit = Cookie.from_set_cookie 'http://foo.com/bar/', 'foo=bar;path=/bar/'
+@@ -84,160 +84,160 @@
+   end
+   describe '#cookie_base_path' do
+     it "should leave '/' alone" do
+-      CookieValidation.cookie_base_path('/').should == '/'
++      expect(CookieValidation.cookie_base_path('/')).to eq '/'
+     end
+     it "should strip off everything after the last '/'" do
+-      CookieValidation.cookie_base_path('/foo/bar/baz').should == '/foo/bar/'
++      expect(CookieValidation.cookie_base_path('/foo/bar/baz')).to eq '/foo/bar/'
+     end
+     it "should handle query parameters and fragments with slashes" do
+-      CookieValidation.cookie_base_path('/foo/bar?query=a/b/c#fragment/b/c').should == '/foo/'
++      expect(CookieValidation.cookie_base_path('/foo/bar?query=a/b/c#fragment/b/c')).to eq '/foo/'
+     end
+     it "should handle URI objects" do
+-      CookieValidation.cookie_base_path(URI.parse('http://www.foo.com/bar/')).should == '/bar/'
++      expect(CookieValidation.cookie_base_path(URI.parse('http://www.foo.com/bar/'))).to eq '/bar/'
+     end
+     it "should preserve case" do
+-      CookieValidation.cookie_base_path("/BaR/").should == '/BaR/'
++      expect(CookieValidation.cookie_base_path("/BaR/")).to eq '/BaR/'
+     end
+   end
+   describe '#determine_cookie_path' do
+     it "should use the requested path when none is specified for the cookie" do
+-      CookieValidation.determine_cookie_path('http://foo.com/', nil).should == '/'
+-      CookieValidation.determine_cookie_path('http://foo.com/bar/baz', '').should == '/bar/'
++      expect(CookieValidation.determine_cookie_path('http://foo.com/', nil)).to eq '/'
++      expect(CookieValidation.determine_cookie_path('http://foo.com/bar/baz', '')).to eq '/bar/'
+     end
+     it "should handle URI objects" do
+-      CookieValidation.determine_cookie_path(URI.parse('http://foo.com/bar/'), '').should == '/bar/'
++      expect(CookieValidation.determine_cookie_path(URI.parse('http://foo.com/bar/'), '')).to eq '/bar/'
+     end
+     it "should handle Cookie objects" do
+       cookie = Cookie.from_set_cookie('http://foo.com/', "name=value;path=/")
+-      CookieValidation.determine_cookie_path('http://foo.com/', cookie).should == '/'
++      expect(CookieValidation.determine_cookie_path('http://foo.com/', cookie)).to eq '/'
+     end
+     it "should ignore the request when a path is specified" do
+-      CookieValidation.determine_cookie_path('http://foo.com/ignorable/path', '/path/').should == '/path/'
++      expect(CookieValidation.determine_cookie_path('http://foo.com/ignorable/path', '/path/')).to eq '/path/'
+     end
+   end
+   describe '#compute_search_domains' do
+     it "should handle subdomains" do
+-      CookieValidation.compute_search_domains('http://www.auth.foo.com/').should ==
+-       ['www.auth.foo.com', '.www.auth.foo.com', '.auth.foo.com']
++      expect(CookieValidation.compute_search_domains('http://www.auth.foo.com/')).to eq(
++       ['www.auth.foo.com', '.www.auth.foo.com', '.auth.foo.com'])
+     end
+     it "should handle root domains" do
+-      CookieValidation.compute_search_domains('http://foo.com/').should ==
+-      ['foo.com', '.foo.com']
++      expect(CookieValidation.compute_search_domains('http://foo.com/')).to eq(
++      ['foo.com', '.foo.com'])
+     end
+     it "should handle hexadecimal TLDs" do
+-      CookieValidation.compute_search_domains('http://tiny.cc/').should ==
+-      ['tiny.cc', '.tiny.cc']
++      expect(CookieValidation.compute_search_domains('http://tiny.cc/')).to eq(
++      ['tiny.cc', '.tiny.cc'])
+     end
+     it "should handle IP addresses" do
+-      CookieValidation.compute_search_domains('http://127.0.0.1/').should ==
+-      ['127.0.0.1']
++      expect(CookieValidation.compute_search_domains('http://127.0.0.1/')).to eq(
++      ['127.0.0.1'])
+     end
+     it "should handle local addresses" do
+-      CookieValidation.compute_search_domains('http://zero/').should == 
+-      ['zero.local', '.zero.local', '.local']
++      expect(CookieValidation.compute_search_domains('http://zero/')).to eq(
++      ['zero.local', '.zero.local', '.local'])
+     end
+   end
+   describe '#determine_cookie_domain' do
+     it "should add a dot to the front of domains" do
+-      CookieValidation.determine_cookie_domain('http://foo.com/', 'foo.com').should == '.foo.com'
++      expect(CookieValidation.determine_cookie_domain('http://foo.com/', 'foo.com')).to eq '.foo.com'
+     end
+     it "should not add a second dot if one present" do
+-      CookieValidation.determine_cookie_domain('http://foo.com/', '.foo.com').should == '.foo.com'
++      expect(CookieValidation.determine_cookie_domain('http://foo.com/', '.foo.com')).to eq '.foo.com'
+     end
+     it "should handle Cookie objects" do
+       c = Cookie.from_set_cookie('http://foo.com/', "foo=bar;domain=foo.com")
+-      CookieValidation.determine_cookie_domain('http://foo.com/', c).should == '.foo.com'
++      expect(CookieValidation.determine_cookie_domain('http://foo.com/', c)).to eq '.foo.com'
+     end
+     it "should handle URI objects" do
+-      CookieValidation.determine_cookie_domain(URI.parse('http://foo.com/'), '.foo.com').should == '.foo.com'
++      expect(CookieValidation.determine_cookie_domain(URI.parse('http://foo.com/'), '.foo.com')).to eq '.foo.com'
+     end
+     it "should use an exact hostname when no domain specified" do
+-      CookieValidation.determine_cookie_domain('http://foo.com/', '').should == 'foo.com'
++      expect(CookieValidation.determine_cookie_domain('http://foo.com/', '')).to eq 'foo.com'
+     end
+     it "should leave IPv4 addresses alone" do
+-      CookieValidation.determine_cookie_domain('http://127.0.0.1/', '127.0.0.1').should == '127.0.0.1'
++      expect(CookieValidation.determine_cookie_domain('http://127.0.0.1/', '127.0.0.1')).to eq '127.0.0.1'
+     end
+     it "should leave IPv6 addresses alone" do
+       ['2001:db8:85a3::8a2e:370:7334', '::ffff:192.0.2.128'].each do |value|
+-        CookieValidation.determine_cookie_domain("http://[#{value}]/", value).should == value
++        expect(CookieValidation.determine_cookie_domain("http://[#{value}]/", value)).to eq value
+       end
+     end
+   end
+   describe "#effective_host" do
+     it "should leave proper domains the same" do
+       ['google.com', 'www.google.com', 'google.com.'].each do |value|
+-        CookieValidation.effective_host(value).should == value
++        expect(CookieValidation.effective_host(value)).to eq  value
+       end
+     end
+     it "should handle a URI object" do
+-      CookieValidation.effective_host(URI.parse('http://example.com/')).should == 'example.com'
++      expect(CookieValidation.effective_host(URI.parse('http://example.com/'))).to eq 'example.com'
+     end	
+     it "should add a local suffix on unqualified hosts" do
+-      CookieValidation.effective_host('localhost').should == 'localhost.local'
++      expect(CookieValidation.effective_host('localhost')).to eq 'localhost.local'
+     end
+     it "should leave IPv4 addresses alone" do
+-      CookieValidation.effective_host('127.0.0.1').should == '127.0.0.1'
++      expect(CookieValidation.effective_host('127.0.0.1')).to eq '127.0.0.1'
+     end
+     it "should leave IPv6 addresses alone" do
+       ['2001:db8:85a3::8a2e:370:7334', ':ffff:192.0.2.128'].each do |value|
+-        CookieValidation.effective_host(value).should == value
++        expect(CookieValidation.effective_host(value)).to eq value
+       end
+     end
+     it "should lowercase addresses" do
+-      CookieValidation.effective_host('FOO.COM').should == 'foo.com'
++      expect(CookieValidation.effective_host('FOO.COM')).to eq 'foo.com'
+     end
+   end
+   describe '#match_domains' do
+     it "should handle exact matches" do
+-      CookieValidation.domains_match('localhost.local', 'localhost.local').should == 'localhost.local'
+-      CookieValidation.domains_match('foo.com', 'foo.com').should == 'foo.com'
+-      CookieValidation.domains_match('127.0.0.1', '127.0.0.1').should == '127.0.0.1'
+-      CookieValidation.domains_match('::ffff:192.0.2.128', '::ffff:192.0.2.128').should == '::ffff:192.0.2.128'
++      expect(CookieValidation.domains_match('localhost.local', 'localhost.local')).to eq 'localhost.local'
++      expect(CookieValidation.domains_match('foo.com', 'foo.com')).to eq 'foo.com'
++      expect(CookieValidation.domains_match('127.0.0.1', '127.0.0.1')).to eq '127.0.0.1'
++      expect(CookieValidation.domains_match('::ffff:192.0.2.128', '::ffff:192.0.2.128')).to eq '::ffff:192.0.2.128'
+     end
+     it "should handle matching a superdomain" do
+-      CookieValidation.domains_match('.foo.com', 'auth.foo.com').should == '.foo.com'
+-      CookieValidation.domains_match('.y.z.foo.com', 'x.y.z.foo.com').should == '.y.z.foo.com'
++      expect(CookieValidation.domains_match('.foo.com', 'auth.foo.com')).to eq '.foo.com'
++      expect(CookieValidation.domains_match('.y.z.foo.com', 'x.y.z.foo.com')).to eq '.y.z.foo.com'
+     end
+     it "should not match superdomains, or illegal domains" do
+-      CookieValidation.domains_match('.z.foo.com', 'x.y.z.foo.com').should be_nil
+-      CookieValidation.domains_match('foo.com', 'com').should be_nil
++      expect(CookieValidation.domains_match('.z.foo.com', 'x.y.z.foo.com')).to be_nil
++      expect(CookieValidation.domains_match('foo.com', 'com')).to be_nil
+     end
+     it "should not match domains with and without a dot suffix together" do
+-      CookieValidation.domains_match('foo.com.', 'foo.com').should be_nil
++      expect(CookieValidation.domains_match('foo.com.', 'foo.com')).to be_nil
+     end
+   end
+   describe '#hostname_reach' do
+     it "should find the next highest subdomain" do
+       {'www.google.com' => 'google.com', 'auth.corp.companyx.com' => 'corp.companyx.com'}.each do |entry|
+-        CookieValidation.hostname_reach(entry[0]).should == entry[1]
++        expect(CookieValidation.hostname_reach(entry[0])).to eq entry[1]
+       end
+     end
+     it "should handle domains with suffixed dots" do
+-      CookieValidation.hostname_reach('www.google.com.').should == 'google.com.'
++      expect(CookieValidation.hostname_reach('www.google.com.')).to eq 'google.com.'
+     end
+     it "should return nil for a root domain" do
+-      CookieValidation.hostname_reach('github.com').should be_nil
++      expect(CookieValidation.hostname_reach('github.com')).to be_nil
+     end
+     it "should return 'local' for a local domain" do
+       ['foo.local', 'foo.local.'].each do |hostname|
+-        CookieValidation.hostname_reach(hostname).should == 'local'
++        expect(CookieValidation.hostname_reach(hostname)).to eq 'local'
+       end
+     end
+     it "should handle mixed-case '.local'" do
+-      CookieValidation.hostname_reach('foo.LOCAL').should == 'local'
++      expect(CookieValidation.hostname_reach('foo.LOCAL')).to eq 'local'
+     end
+     it "should return nil for an IPv4 address" do
+-      CookieValidation.hostname_reach('127.0.0.1').should be_nil
++      expect(CookieValidation.hostname_reach('127.0.0.1')).to be_nil
+     end
+     it "should return nil for IPv6 addresses" do
+       ['2001:db8:85a3::8a2e:370:7334', '::ffff:192.0.2.128'].each do |value|
+-        CookieValidation.hostname_reach(value).should be_nil
++        expect(CookieValidation.hostname_reach(value)).to be_nil
+       end
+     end
+   end
+   describe '#parse_set_cookie' do
+     it "should max out at 2038 on 32bit systems" do
+-      CookieValidation.parse_set_cookie("TRACK_USER_P=98237480810003948000782774;expires=Sat, 30-Jun-2040 05:39:49 GMT;path=/")[:expires_at].to_i.should >= 0x7FFFFFFF
++      expect(CookieValidation.parse_set_cookie("TRACK_USER_P=98237480810003948000782774;expires=Sat, 30-Jun-2040 05:39:49 GMT;path=/")[:expires_at].to_i).to be >= 0x7FFFFFFF
+     end
+   end  
+ end
+\ No newline at end of file
+diff --git a/spec/jar_spec.rb b/spec/jar_spec.rb
+index e570624..67bf498 100644
+--- a/spec/jar_spec.rb
++++ b/spec/jar_spec.rb
+@@ -27,12 +27,12 @@
+       jar.set_cookie 'http://foo.com/', 'bar=baz'
+       jar.set_cookie 'http://auth.foo.com/', 'foo=bar'
+       jar.set_cookie 'http://auth.foo.com/', 'auth=135121...;domain=foo.com'
+-      jar.get_cookies('http://foo.com/').should have(3).items
++      expect(jar.get_cookies('http://foo.com/')).to have(3).items
+     end
+     it "should let me read back a multiple cookies from 1 header" do
+       jar = Jar.new
+       jar.set_cookie 'http://foo.com/', 'my_cookie=123456; Domain=foo.com; expires=Thu, 31 Dec 2037 23:59:59 GMT; Path=/, other_cookie=helloworld; Domain=foo.com; expires=Thu, 31 Dec 2037 23:59:59 GMT, last_cookie=098765'
+-      jar.get_cookie_header('http://foo.com/').should == 'last_cookie=098765;my_cookie=123456;other_cookie=helloworld'
++      expect(jar.get_cookie_header('http://foo.com/')).to eq 'last_cookie=098765;my_cookie=123456;other_cookie=helloworld'
+     end
+     it "should return cookies longest path first" do
+       jar = Jar.new
+@@ -42,18 +42,18 @@
+       jar.set_cookie uri, 'c=bar;path=/a/b'
+       jar.set_cookie uri, 'd=bar;path=/a/'
+       cookies = jar.get_cookies(uri)
+-      cookies.should have(4).items
+-      cookies[0].name.should == 'b'
+-      cookies[1].name.should == 'a'
+-      cookies[2].name.should == 'c'
+-      cookies[3].name.should == 'd'
++      expect(cookies).to have(4).items
++      expect(cookies[0].name).to eq 'b'
++      expect(cookies[1].name).to eq 'a'
++      expect(cookies[2].name).to eq 'c'
++      expect(cookies[3].name).to eq 'd'
+     end
+     it "should not return expired cookies" do
+       jar = Jar.new
+       uri = 'http://localhost/'
+       jar.set_cookie uri, 'foo=bar;expires=Wednesday, 09-Nov-99 23:12:40 GMT'
+       cookies = jar.get_cookies(uri)
+-      cookies.should have(0).items
++      expect(cookies).to have(0).items
+     end
+   end
+   describe '.get_cookie_headers' do
+@@ -63,7 +63,7 @@
+       jar.set_cookie uri, 'a=bar'
+       jar.set_cookie uri, 'b=baz;path=/a/b/c/d'
+       cookie_headers = jar.get_cookie_header uri
+-      cookie_headers.should == "b=baz;a=bar"
++      expect(cookie_headers).to eq "b=baz;a=bar"
+     end
+     it "should handle a version 1 cookie" do
+       jar = Jar.new
+@@ -72,7 +72,7 @@
+       jar.set_cookie uri, 'b=baz;path=/a/b/c/d'
+       jar.set_cookie2 uri, 'c=baz;Version=1;path="/"'
+       cookie_headers = jar.get_cookie_header uri
+-      cookie_headers.should == '$Version=0;b=baz;$Path="/a/b/c/d";a=bar;$Path="/a/b/c/",$Version=1;c=baz;$Path="/"'
++      expect(cookie_headers).to eq '$Version=0;b=baz;$Path="/a/b/c/d";a=bar;$Path="/a/b/c/",$Version=1;c=baz;$Path="/"'
+     end
+   end
+   describe '.add_cookie' do
+@@ -91,7 +91,7 @@
+       jar.set_cookie uri, 'c=bar;path=/a/b'
+       jar.set_cookie uri, 'd=bar;path=/a/'
+       jar.set_cookie 'http://localhost/', 'foo=bar'
+-      jar.to_a.should have(5).items
++      expect(jar.to_a).to have(5).items
+     end
+   end
+   describe '.expire_cookies' do
+@@ -103,9 +103,9 @@
+       jar.set_cookie uri, 'c=bar;path=/a/b'
+       jar.set_cookie uri, 'd=bar;path=/a/'
+       jar.set_cookie 'http://localhost/', 'foo=bar'
+-      jar.to_a.should have(5).items
++      expect(jar.to_a).to have(5).items
+       jar.expire_cookies
+-      jar.to_a.should have(4).items
++      expect(jar.to_a).to have(4).items
+     end
+     it "should let me expire all session cookies" do
+       uri = 'http://foo.com/a/b/c/d' 
+@@ -115,9 +115,9 @@
+       jar.set_cookie uri, 'c=bar;path=/a/b'
+       jar.set_cookie uri, 'd=bar;path=/a/'
+       jar.set_cookie 'http://localhost/', 'foo=bar'
+-      jar.to_a.should have(5).items
++      expect(jar.to_a).to have(5).items
+       jar.expire_cookies true
+-      jar.to_a.should have(1).items
++      expect(jar.to_a).to have(1).items
+     end
+   end
+   describe '#set_cookies_from_headers' do
+@@ -125,70 +125,70 @@
+       jar = Jar.new
+       cookies = jar.set_cookies_from_headers 'http://localhost/', 
+       { 'Set-Cookie' => 'foo=bar' } 
+-      cookies.should have(1).items
+-      jar.to_a.should have(1).items
++      expect(cookies).to have(1).items
++      expect(jar.to_a).to have(1).items
+     end
+     it "should handle a set-cookie header" do
+       jar = Jar.new
+       cookies = jar.set_cookies_from_headers 'http://localhost/', 
+       { 'set-cookie' => 'foo=bar' } 
+-      cookies.should have(1).items
+-      jar.to_a.should have(1).items
++      expect(cookies).to have(1).items
++      expect(jar.to_a).to have(1).items
+     end
+     it "should handle multiple Set-Cookie headers" do
+       jar = Jar.new
+       cookies = jar.set_cookies_from_headers 'http://localhost/', 
+       { 'Set-Cookie' => ['foo=bar','bar=baz'] } 
+-      cookies.should have(2).items
+-      jar.to_a.should have(2).items
++      expect(cookies).to have(2).items
++      expect(jar.to_a).to have(2).items
+     end
+     it "should handle a Set-Cookie2 header" do
+       jar = Jar.new
+       cookies = jar.set_cookies_from_headers 'http://localhost/', 
+       { 'Set-Cookie2' => 'foo=bar;Version=1' } 
+-      cookies.should have(1).items
+-      jar.to_a.should have(1).items
++      expect(cookies).to have(1).items
++      expect(jar.to_a).to have(1).items
+     end
+     it "should handle a set-cookie2 header" do
+       jar = Jar.new
+       cookies = jar.set_cookies_from_headers 'http://localhost/', 
+       { 'set-cookie2' => 'foo=bar;Version=1' } 
+-      cookies.should have(1).items
+-      jar.to_a.should have(1).items
++      expect(cookies).to have(1).items
++      expect(jar.to_a).to have(1).items
+     end
+     it "should handle multiple Set-Cookie2 headers" do
+       jar = Jar.new
+       cookies = jar.set_cookies_from_headers 'http://localhost/', 
+       { 'Set-Cookie2' => ['foo=bar;Version=1','bar=baz;Version=1'] } 
+-      cookies.should have(2).items
+-      jar.to_a.should have(2).items
++      expect(cookies).to have(2).items
++      expect(jar.to_a).to have(2).items
+     end
+     it "should handle mixed distinct Set-Cookie and Set-Cookie2 headers" do
+       jar = Jar.new
+       cookies = jar.set_cookies_from_headers 'http://localhost/', 
+       { 'Set-Cookie' => 'foo=bar',
+         'Set-Cookie2' => 'bar=baz;Version=1' } 
+-      cookies.should have(2).items
+-      jar.to_a.should have(2).items
++        expect(cookies).to have(2).items
++        expect(jar.to_a).to have(2).items
+     end
+     it "should handle overlapping Set-Cookie and Set-Cookie2 headers" do
+       jar = Jar.new
+       cookies = jar.set_cookies_from_headers 'http://localhost/', 
+       { 'Set-Cookie' => ['foo=bar','bar=baz'],
+         'Set-Cookie2' => 'foo=bar;Version=1' } 
+-      cookies.should have(2).items
+-      jar.to_a.should have(2).items
++        expect(cookies).to have(2).items
++        expect(jar.to_a).to have(2).items
+       # and has the version 1 cookie
+-      cookies.find do |cookie|
++      expect(cookies.find do |cookie|
+         cookie.name == 'foo'
+-      end.version.should == 1
++      end.version).to eq 1
+     end
+     it "should silently drop invalid cookies" do
+       jar = Jar.new
+       cookies = jar.set_cookies_from_headers 'http://localhost/', 
+       { 'Set-Cookie' => ['foo=bar','bar=baz;domain=.foo.com'] } 
+-      cookies.should have(1).items
+-      jar.to_a.should have(1).items
++      expect(cookies).to have(1).items
++      expect(jar.to_a).to have(1).items
+     end
+   end
+   begin
+@@ -200,7 +200,7 @@
+         jar = Jar.new
+         jar.add_cookie c
+         json = jar.to_json
+-        json.should be_a String
++        expect(json).to be_a String
+       end
+     end
+     describe ".json_create" do
+@@ -209,25 +209,25 @@
+         array = JSON.parse json
+        
+         jar = Jar.json_create array
+-        jar.get_cookies('https://localhost/').should have(1).items
++        expect(jar.get_cookies('https://localhost/')).to have(1).items
+       end
+       it "should deserialize a JSON hash to a jar" do
+         json = "{\"cookies\":[{\"name\":\"foo\",\"value\":\"bar\",\"domain\":\"localhost.local\",\"path\":\"\\/\",\"created_at\":\"2009-09-11 12:51:03 -0600\",\"expiry\":\"2028-11-01 12:00:00 GMT\",\"secure\":true}]}" 
+         hash = JSON.parse json
+         
+         jar = Jar.json_create hash
+-        jar.get_cookies('https://localhost/').should have(1).items
++        expect(jar.get_cookies('https://localhost/')).to have(1).items
+       end
+       
+       it "should automatically deserialize to a jar" do
+         json = "{\"json_class\":\"CookieJar::Jar\",\"cookies\":[{\"name\":\"foo\",\"value\":\"bar\",\"domain\":\"localhost.local\",\"path\":\"\\/\",\"created_at\":\"2009-09-11 12:51:03 -0600\",\"expiry\":\"2028-11-01 12:00:00 GMT\",\"secure\":true}]}" 
+         jar = JSON.parse json, :create_additions => true
+-        jar.get_cookies('https://localhost/').should have(1).items  
++        expect(jar.get_cookies('https://localhost/')).to have(1).items  
+       end
+     end
+   rescue LoadError
+     it "does not appear the JSON library is installed" do
+-       raise 'please install the JSON lirbary'
++       raise 'please install the JSON library'
+     end
+   end
+ end
diff --git a/debian/patches/series b/debian/patches/series
new file mode 100644
index 0000000..84dfeba
--- /dev/null
+++ b/debian/patches/series
@@ -0,0 +1,2 @@
+rspec299.patch
+rspec3.patch

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-ruby-extras/ruby-cookiejar.git



More information about the Pkg-ruby-extras-commits mailing list