faraday-cookie_jar 0.0.5 → 0.0.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 23be36b8be03b487d50d756a69c6f3e6996a1e2f
4
- data.tar.gz: 80be5d729297d81d752dce3c0ff65c11e6d04911
3
+ metadata.gz: a8195f07090b241910a6e10b5507219a4e1b0bb0
4
+ data.tar.gz: cfdbddb3fd497aa3e1afc96b9d0987e0817d2459
5
5
  SHA512:
6
- metadata.gz: eedf7cd419797c390d238fab7a48b198a37855653d17af0283a56f020f92587f3a31b3ebc93ab4f3769979a2b1e308d17e3c7cd88c170e9b24d7f4ea426f8e6e
7
- data.tar.gz: 05c368592c7eea598722a17fb9b3cfb88d4d11f7c38d91c4c7c48d022fb06eb43e7a244ea0b51a5b1731bc419e99cfc95dd502fd92245c509bb9f6c619b5a748
6
+ metadata.gz: b97438bab250cb4ce8a6f3d03f0df750adfa3bd5b82ced61bf50dd52d995967c875e9eec207d50826833d4f5a6c218e86b8b72b0d159acb819f0ee2c24c66bf4
7
+ data.tar.gz: 93c1ee9c3fa64a9491a442028ee2ce1f12921722419613b43bd4481b61920bdab81e19087f591e67afea1ed74c5a80ab5a3f823f8d3c4584aa3b2ef378d6a140
@@ -1,3 +1,8 @@
1
+ ## 0.0.6 Tue Jan 21 16:34:35 PST 2014
2
+
3
+ - Support Faraday 0.9 registry API (cameron-martin)
4
+ - Support specifying CookieJar in configuration (cameron-martin)
5
+
1
6
  ## 0.0.5 Mon Jan 20 21:53:13 PST 2014
2
7
 
3
8
  - Lock faraday dependency to < 0.9.0 for now
@@ -18,7 +18,7 @@ Gem::Specification.new do |spec|
18
18
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
19
  spec.require_paths = ["lib"]
20
20
 
21
- spec.add_dependency "faraday", ">= 0.7.4", "< 0.9.0"
21
+ spec.add_dependency "faraday", ">= 0.7.4"
22
22
  spec.add_dependency "http-cookie", "~> 1.0.0"
23
23
 
24
24
  spec.add_development_dependency "bundler", "~> 1.3"
@@ -5,7 +5,7 @@ module Faraday
5
5
  class CookieJar < Faraday::Middleware
6
6
  def initialize(app, options = {})
7
7
  super(app)
8
- @jar = HTTP::CookieJar.new
8
+ @jar = options[:jar] || HTTP::CookieJar.new
9
9
  end
10
10
 
11
11
  def call(env)
@@ -32,4 +32,6 @@ end
32
32
 
33
33
  if Faraday.respond_to? :register_middleware
34
34
  Faraday.register_middleware :cookie_jar => lambda { Faraday::CookieJar }
35
+ elsif Faraday::Middleware.respond_to? :register_middleware
36
+ Faraday::Middleware.register_middleware :cookie_jar => Faraday::CookieJar
35
37
  end
@@ -1,5 +1,5 @@
1
1
  module Faraday
2
2
  module CookieJarVersion
3
- VERSION = "0.0.5"
3
+ VERSION = "0.0.6"
4
4
  end
5
5
  end
@@ -2,6 +2,7 @@ require 'spec_helper'
2
2
 
3
3
  describe Faraday::CookieJar do
4
4
  let(:conn) { Faraday.new(:url => 'http://faraday.example.com') }
5
+ let(:cookie_jar) { HTTP::CookieJar.new }
5
6
 
6
7
  before do
7
8
  conn.use :cookie_jar
@@ -10,19 +11,32 @@ describe Faraday::CookieJar do
10
11
 
11
12
  it 'get default cookie' do
12
13
  conn.get('/default')
13
- conn.get('/dump').body.should == 'foo=bar'
14
+ expect(conn.get('/dump').body).to eq('foo=bar')
14
15
  end
15
16
 
16
17
  it 'does not send cookies to wrong path' do
17
18
  conn.get('/path')
18
- conn.get('/dump').body.should_not == 'foo=bar'
19
+ expect(conn.get('/dump').body).to_not eq('foo=bar')
19
20
  end
20
21
 
21
22
  it 'expires cookie' do
22
23
  conn.get('/expires')
23
- conn.get('/dump').body.should == 'foo=bar'
24
+ expect(conn.get('/dump').body).to eq('foo=bar')
24
25
  sleep 2
25
- conn.get('/dump').body.should_not == 'foo=bar'
26
+ expect(conn.get('/dump').body).to_not eq('foo=bar')
27
+ end
28
+
29
+ it 'fills an injected cookie jar' do
30
+
31
+ conn_with_jar = Faraday.new(:url => 'http://faraday.example.com') do |conn|
32
+ conn.use :cookie_jar, jar: cookie_jar
33
+ conn.adapter :net_http # for sham_rock
34
+ end
35
+
36
+ conn_with_jar.get('/default')
37
+
38
+ expect(cookie_jar.empty?).to be_false
39
+
26
40
  end
27
41
 
28
42
  it 'multiple cookies' do
@@ -33,7 +47,7 @@ describe Faraday::CookieJar do
33
47
  request.headers.merge!({:Cookie => 'language=english'})
34
48
  end
35
49
 
36
- response.body.should == 'foo=bar;language=english'
50
+ expect(response.body).to eq('foo=bar;language=english')
37
51
  end
38
52
  end
39
53
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: faraday-cookie_jar
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tatsuhiko Miyagawa
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-01-21 00:00:00.000000000 Z
11
+ date: 2014-01-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
@@ -17,9 +17,6 @@ dependencies:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
19
  version: 0.7.4
20
- - - "<"
21
- - !ruby/object:Gem::Version
22
- version: 0.9.0
23
20
  type: :runtime
24
21
  prerelease: false
25
22
  version_requirements: !ruby/object:Gem::Requirement
@@ -27,9 +24,6 @@ dependencies:
27
24
  - - ">="
28
25
  - !ruby/object:Gem::Version
29
26
  version: 0.7.4
30
- - - "<"
31
- - !ruby/object:Gem::Version
32
- version: 0.9.0
33
27
  - !ruby/object:Gem::Dependency
34
28
  name: http-cookie
35
29
  requirement: !ruby/object:Gem::Requirement