faraday-conductivity 0.3.0 → 0.3.1

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: 81337bd02893a9e0365427e2f498fc299c9bfd91
4
- data.tar.gz: b35b5bf0cf8e97c222b7a08d2425f6ffc47210d7
3
+ metadata.gz: 37144ee9e787b4eba24b366cff58a3d437e5670c
4
+ data.tar.gz: 577ec27bee6892d8a73382eb1018e726236ce2a4
5
5
  SHA512:
6
- metadata.gz: ff06c7a6e23d062a62cf24bc02867c9ec23243afcf284dec10bdf4737d97bb2cbfa23befd52907d4b2e590b41205a24398e78572513da26491f8c47d6027e9ed
7
- data.tar.gz: 88b20bf120f272d9c2e16908bd2bcbc650befac32e64ba6570d3cc103ac3244af517d2c7cd90d33883c6a697f24a174c5da87bd2ebd437b577de2f55e3510069
6
+ metadata.gz: dce521f65e52e0fa0cfc168d4bd3fe5fded12ecbc5267a9c8632772c19f9e75713f9a84a7013d2bb2e1979e8c8f79eed7b1293da78b751dc64757a8fbf277e56
7
+ data.tar.gz: c65886c49d1ccaf753bdeeca1133aa002070c9b9354499fcb82ab9b619cb8a5944a86db4511866cb63f7f260a9325111f33e129797c1505d20981439189b8188
data/.rspec CHANGED
@@ -1,2 +1,4 @@
1
1
  --format documentation
2
2
  --color
3
+ --require spec_helper
4
+ --order random
@@ -20,7 +20,7 @@ Gem::Specification.new do |gem|
20
20
 
21
21
  gem.add_dependency "faraday", "~> 0.8"
22
22
  gem.add_development_dependency "rake"
23
- gem.add_development_dependency "rspec"
23
+ gem.add_development_dependency "rspec", "~> 3"
24
24
  gem.add_development_dependency "pry"
25
25
  gem.add_development_dependency "service_double"
26
26
  gem.add_development_dependency "appraisal"
@@ -2,8 +2,11 @@ module Faraday
2
2
  module Conductivity
3
3
  class RequestIdFilter
4
4
 
5
- def self.filter(controller)
6
- Thread.current[:request_id] = controller.request.uuid
5
+ class << self
6
+ def filter(controller)
7
+ Thread.current[:request_id] = controller.request.uuid
8
+ end
9
+ alias_method :before, :filter
7
10
  end
8
11
 
9
12
  end
@@ -1,5 +1,5 @@
1
1
  module Faraday
2
2
  module Conductivity
3
- VERSION = "0.3.0"
3
+ VERSION = "0.3.1"
4
4
  end
5
5
  end
@@ -1,40 +1,39 @@
1
- require 'spec_helper'
2
1
  require 'logger'
3
2
 
4
- describe Faraday::Conductivity::ExtendedLogging do
3
+ RSpec.describe Faraday::Conductivity::ExtendedLogging do
5
4
 
6
5
  subject(:log) { io.read }
7
6
 
8
7
  it "includes the HTTP verb" do
9
- log.should include "GET"
8
+ expect(log).to include "GET"
10
9
  end
11
10
 
12
11
  it "includes the request body" do
13
- log.should include "the request body"
12
+ expect(log).to include "the request body"
14
13
  end
15
14
 
16
15
  it "includes the request headers" do
17
- log.should match %r"X-Foo\s+: bar"
16
+ expect(log).to match %r"X-Foo\s+: bar"
18
17
  end
19
18
 
20
19
  it "includes the complete URL" do
21
- log.should include "http://widgets.example.org/test"
20
+ expect(log).to include "http://widgets.example.org/test"
22
21
  end
23
22
 
24
23
  it "includes the response status" do
25
- log.should include "200"
24
+ expect(log).to include "200"
26
25
  end
27
26
 
28
27
  it "includes the response time" do
29
- log.should match(/\d+\.\d+ms/)
28
+ expect(log).to match(/\d+\.\d+ms/)
30
29
  end
31
30
 
32
31
  it "includes the response headers" do
33
- log.should include "X-Bar : foo"
32
+ expect(log).to include "X-Bar : foo"
34
33
  end
35
34
 
36
35
  it "includes the response body" do
37
- log.should include "the response body"
36
+ expect(log).to include "the response body"
38
37
  end
39
38
 
40
39
  before do
@@ -1,11 +1,9 @@
1
- require 'spec_helper'
2
-
3
- describe Faraday::Conductivity::Mimetype do
1
+ RSpec.describe Faraday::Conductivity::Mimetype do
4
2
 
5
3
  subject(:request_headers) { response.env[:request_headers] }
6
4
 
7
5
  it "includes the mimetype specified" do
8
- request_headers["Accept"].should eq mimetype
6
+ expect(request_headers["Accept"]).to eq mimetype
9
7
  end
10
8
 
11
9
  let(:mimetype) { "application/vnd.users-v2+json" }
@@ -1,6 +1,4 @@
1
- require 'spec_helper'
2
-
3
- describe Faraday::Conductivity::Repeater do
1
+ RSpec.describe Faraday::Conductivity::Repeater do
4
2
 
5
3
  let(:connection) {
6
4
  Faraday.new(url: $service_double_url) { |faraday|
@@ -11,7 +9,7 @@ describe Faraday::Conductivity::Repeater do
11
9
  }
12
10
 
13
11
  it "retries after timeouts" do
14
- get_with_max(4).body.should eq "fast"
12
+ expect(get_with_max(4).body).to eq "fast"
15
13
  end
16
14
 
17
15
  it "gives up after a number of retries" do
@@ -34,9 +32,9 @@ describe Faraday::Conductivity::Repeater do
34
32
 
35
33
  it "waits according to a pattern" do
36
34
  pattern = MyPattern.new
37
- Faraday::Conductivity::Repeater::Pattern.should_receive(:new).and_return(pattern)
35
+ expect(Faraday::Conductivity::Repeater::Pattern).to receive(:new).and_return(pattern)
38
36
  get_with_max(6)
39
- pattern.waited.should eq pattern.waited.sort
37
+ expect(pattern.waited).to eq pattern.waited.sort
40
38
  end
41
39
 
42
40
  it "handles other errors too" do
@@ -46,9 +44,9 @@ describe Faraday::Conductivity::Repeater do
46
44
  }
47
45
 
48
46
  pattern = double :pattern
49
- Faraday::Conductivity::Repeater::Pattern.should_receive(:new).and_return(pattern)
50
- pattern.should_receive(:wait).with(1).ordered
51
- pattern.should_receive(:wait).with(2).ordered
47
+ expect(Faraday::Conductivity::Repeater::Pattern).to receive(:new).and_return(pattern)
48
+ expect(pattern).to receive(:wait).with(1).ordered
49
+ expect(pattern).to receive(:wait).with(2).ordered
52
50
 
53
51
  expect { connection.get("/") }.to raise_error(Faraday::Error::ConnectionFailed)
54
52
  end
@@ -1,6 +1,4 @@
1
- require "spec_helper"
2
-
3
- describe Faraday::Conductivity::RequestHeaders do
1
+ RSpec.describe Faraday::Conductivity::RequestHeaders do
4
2
 
5
3
  it "includes the mimetype specified" do
6
4
  connection = create_connection do |faraday|
@@ -8,8 +6,8 @@ describe Faraday::Conductivity::RequestHeaders do
8
6
  end
9
7
  request_headers = connection.get("/test").env[:request_headers]
10
8
 
11
- request_headers["Accept"].should eq "application/json"
12
- request_headers["X-Version-Number"].should eq "123"
9
+ expect(request_headers["Accept"]).to eq "application/json"
10
+ expect(request_headers["X-Version-Number"]).to eq "123"
13
11
  end
14
12
 
15
13
  it "doesn't override locally specified headers" do
@@ -22,7 +20,7 @@ describe Faraday::Conductivity::RequestHeaders do
22
20
 
23
21
  request_headers = response.env[:request_headers]
24
22
 
25
- request_headers["Accept"].should eq "application/xml"
23
+ expect(request_headers["Accept"]).to eq "application/xml"
26
24
  end
27
25
 
28
26
  end
@@ -1,17 +1,15 @@
1
- require 'spec_helper'
2
-
3
- describe Faraday::Conductivity::RequestId do
1
+ RSpec.describe Faraday::Conductivity::RequestId do
4
2
 
5
3
  subject(:request_headers) { response.env[:request_headers] }
6
4
 
7
5
  it "includes the thread local variable" do
8
6
  Thread.current[:request_id] = "my-request-id"
9
- request_headers["X-Request-Id"].should eq "my-request-id"
7
+ expect(request_headers["X-Request-Id"]).to eq "my-request-id"
10
8
  end
11
9
 
12
10
  it "doesn't add the header if there is no request id" do
13
11
  Thread.current[:request_id] = nil
14
- request_headers.should_not have_key "X-Request-Id"
12
+ expect(request_headers).not_to have_key "X-Request-Id"
15
13
  end
16
14
 
17
15
  def connection
@@ -1,6 +1,4 @@
1
- require 'spec_helper'
2
-
3
- describe Faraday::Conductivity::SelectiveErrors do
1
+ RSpec.describe Faraday::Conductivity::SelectiveErrors do
4
2
 
5
3
  subject(:request_headers) { response.env[:request_headers] }
6
4
 
@@ -1,39 +1,37 @@
1
- require 'spec_helper'
2
-
3
- describe Faraday::Conductivity::UserAgent do
1
+ RSpec.describe Faraday::Conductivity::UserAgent do
4
2
 
5
3
  subject(:user_agent) { response.env[:request_headers]["User-Agent"] }
6
4
 
7
5
  it "includes the name and version of the app" do
8
- user_agent.should start_with "MarketingSite/1.1"
6
+ expect(user_agent).to start_with "MarketingSite/1.1"
9
7
  end
10
8
 
11
9
  it "includes the current ruby version" do
12
- user_agent.should include RUBY_VERSION
10
+ expect(user_agent).to include RUBY_VERSION
13
11
  end
14
12
 
15
13
  it "includes the current ruby engine" do
16
- user_agent.should include RUBY_ENGINE
14
+ expect(user_agent).to include RUBY_ENGINE
17
15
  end
18
16
 
19
17
  it "includes the current ruby patch level" do
20
- user_agent.should include RUBY_PATCHLEVEL.to_s
18
+ expect(user_agent).to include RUBY_PATCHLEVEL.to_s
21
19
  end
22
20
 
23
21
  it "includes the platform" do
24
- user_agent.should include RUBY_PLATFORM
22
+ expect(user_agent).to include RUBY_PLATFORM
25
23
  end
26
24
 
27
25
  it "includes the pid" do
28
- user_agent.should include "1337"
26
+ expect(user_agent).to include "1337"
29
27
  end
30
28
 
31
29
  it "includes the current host" do
32
- user_agent.should include "my.hostname"
30
+ expect(user_agent).to include "my.hostname"
33
31
  end
34
32
 
35
33
  it "includes the current user name" do
36
- user_agent.should include "linus"
34
+ expect(user_agent).to include "linus"
37
35
  end
38
36
 
39
37
  let(:environment) {
@@ -28,10 +28,7 @@ module SpecHelper
28
28
  end
29
29
 
30
30
  RSpec.configure do |config|
31
- config.treat_symbols_as_metadata_keys_with_true_values = true
32
- config.run_all_when_everything_filtered = true
33
- config.filter_run :focus
34
- config.order = 'random'
31
+ config.disable_monkey_patching!
35
32
  config.include SpecHelper
36
33
  end
37
34
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: faraday-conductivity
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - iain
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-03-28 00:00:00.000000000 Z
11
+ date: 2014-11-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
@@ -42,16 +42,16 @@ dependencies:
42
42
  name: rspec
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - ">="
45
+ - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: '0'
47
+ version: '3'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - ">="
52
+ - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: '0'
54
+ version: '3'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: pry
57
57
  requirement: !ruby/object:Gem::Requirement
@@ -165,3 +165,4 @@ test_files:
165
165
  - spec/middleware/selective_errors_spec.rb
166
166
  - spec/middleware/user_agent_spec.rb
167
167
  - spec/spec_helper.rb
168
+ has_rdoc: