faraday 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
data/README.rdoc CHANGED
@@ -54,12 +54,14 @@ This mess is gonna get raw, like sushi. So, haters to the left.
54
54
  Using the MockRequest connection adapter you can implement your own test
55
55
  connection class:
56
56
 
57
+ # customize your own TestConnection or just use Faraday::TestConnection
57
58
  class TestConnection < Faraday::Connection
58
- extend Faraday::Adapter::MockRequest
59
+ include Faraday::Adapter::MockRequest
59
60
  end
60
61
 
61
62
  conn = TestConnection.new do |stub|
62
- stub.get('/hello.json', { 'hi world' }
63
+ # response mimics a rack response
64
+ stub.get('/hello.json') { [200, {}, 'hi world'] }
63
65
  end
64
66
  resp = conn.get '/hello.json'
65
67
  resp.body # => 'hi world'
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.1
1
+ 0.0.2
data/faraday.gemspec CHANGED
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{faraday}
8
- s.version = "0.0.1"
8
+ s.version = "0.0.2"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["rick"]
@@ -32,6 +32,7 @@ Gem::Specification.new do |s|
32
32
  "lib/faraday/error.rb",
33
33
  "lib/faraday/response.rb",
34
34
  "lib/faraday/response/yajl_response.rb",
35
+ "lib/faraday/test_connection.rb",
35
36
  "test/adapter/typhoeus_test.rb",
36
37
  "test/adapter_test.rb",
37
38
  "test/connection_test.rb",
data/lib/faraday.rb CHANGED
@@ -7,9 +7,10 @@ module Faraday
7
7
  end
8
8
  end
9
9
 
10
- autoload :Connection, 'faraday/connection'
11
- autoload :Response, 'faraday/response'
12
- autoload :Error, 'faraday/error'
10
+ autoload :Connection, 'faraday/connection'
11
+ autoload :TestConnection, 'faraday/test_connection'
12
+ autoload :Response, 'faraday/response'
13
+ autoload :Error, 'faraday/error'
13
14
 
14
15
  module Adapter
15
16
  autoload :NetHttp, 'faraday/adapter/net_http'
@@ -0,0 +1,5 @@
1
+ module Faraday
2
+ class TestConnection < Connection
3
+ include Faraday::Adapter::MockRequest
4
+ end
5
+ end
data/test/helper.rb CHANGED
@@ -11,9 +11,5 @@ require 'faraday'
11
11
  module Faraday
12
12
  class TestCase < Test::Unit::TestCase
13
13
  LIVE_SERVER = 'http://localhost:4567'
14
-
15
- class TestConnection < Faraday::Connection
16
- include Faraday::Adapter::MockRequest
17
- end
18
14
  end
19
15
  end
@@ -14,7 +14,7 @@ class ResponseTest < Faraday::TestCase
14
14
 
15
15
  describe "TestConnection#get with default Faraday::Response class" do
16
16
  it "returns Faraday::Response" do
17
- conn = TestConnection.new do |stub|
17
+ conn = Faraday::TestConnection.new do |stub|
18
18
  stub.get('/hello') { [200, {}, 'hello world']}
19
19
  end
20
20
  resp = conn.get('/hello')
@@ -24,7 +24,7 @@ class ResponseTest < Faraday::TestCase
24
24
 
25
25
  describe "TestConnection#get with Faraday::YajlResponse class" do
26
26
  it "returns string body" do
27
- conn = TestConnection.new do |stub|
27
+ conn = Faraday::TestConnection.new do |stub|
28
28
  stub.get('/hello') { [200, {}, '[1,2,3]']}
29
29
  end
30
30
  conn.response_class = Faraday::Response::YajlResponse
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: faraday
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - rick
@@ -38,6 +38,7 @@ files:
38
38
  - lib/faraday/error.rb
39
39
  - lib/faraday/response.rb
40
40
  - lib/faraday/response/yajl_response.rb
41
+ - lib/faraday/test_connection.rb
41
42
  - test/adapter/typhoeus_test.rb
42
43
  - test/adapter_test.rb
43
44
  - test/connection_test.rb