routemaster-drain 2.2.2 → 2.3.0

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: 1f2f159625c82cda6149dd385d892605cbbc5381
4
- data.tar.gz: 4355b7da645ddcaed97629f458ea056e037f1c1f
3
+ metadata.gz: 1fd71f8707bbb1dcb850a267cd9d34c739848464
4
+ data.tar.gz: ac8e9c641add1bf27d1eee9f96d7299d6ce7f686
5
5
  SHA512:
6
- metadata.gz: 38adf1dbf83ed92e88ba395cb0cd1cded85c9146d9efafe112d290171663ff7f2794440eb56173e1ea20d05ff30c0353320a834a5d0d6c826294d841028fe4da
7
- data.tar.gz: 45eac309ef2f3be2339b967b5f46075f1e314a2e07bfe32a1a6b125c4035697872071e4301c644011e4570e61b7676678187a25696e9e4bac18b2b66132ad04e
6
+ metadata.gz: 7a248eb16c4595c21ea88f19331fd61e47e4a63b5a2a30eae0617201f4a4c854e5fc5baf8de632ab4b4ae72e2d1fa015b25305ffcdd9e988c71d4daff818adca
7
+ data.tar.gz: b1b5d6c5ca784b7dbd21f14a63640c78c7f1fa422fe492f0aaa9a4d2b4d84cbc93b2c701194ded0bf96f74a3a771fc6ce50eabd307ed3bc73dd3f1182ac32fb6
data/CHANGELOG.md CHANGED
@@ -1,10 +1,15 @@
1
+ ### 2.3.0 (2017-01-16)
2
+
3
+ - Add #has? method on HateoasResponse of identifying resource without invocation
4
+ - Fix 404 breaking CacheAndSweep job run
5
+
1
6
  ### 2.2.2 (2017-01-10)
2
7
 
3
8
  - Fix logging for error responses:
4
9
  For unsuccessful responses rescue the raised error and
5
10
  send increment signal to metrics backend
6
11
  - Add Telemetry support for requests and responses
7
- - Add support for PATCH requests.
12
+ - Add support for PATCH requests.
8
13
  Invalidate cached response (if any) on PATCH
9
14
 
10
15
  ### 2.0.0 (2016-12-14)
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- routemaster-drain (2.2.2)
4
+ routemaster-drain (2.3.0)
5
5
  faraday (>= 0.9.0)
6
6
  faraday_middleware
7
7
  hashie
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: ../
3
3
  specs:
4
- routemaster-drain (2.2.1)
4
+ routemaster-drain (2.3.0)
5
5
  faraday (>= 0.9.0)
6
6
  faraday_middleware
7
7
  hashie
@@ -61,7 +61,7 @@ GEM
61
61
  docile (1.1.5)
62
62
  dotenv (2.1.1)
63
63
  erubis (2.7.0)
64
- faraday (0.10.0)
64
+ faraday (0.10.1)
65
65
  multipart-post (>= 1.2, < 3)
66
66
  faraday_middleware (0.10.1)
67
67
  faraday (>= 0.7.4, < 1.0)
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: ../
3
3
  specs:
4
- routemaster-drain (2.2.1)
4
+ routemaster-drain (2.3.0)
5
5
  faraday (>= 0.9.0)
6
6
  faraday_middleware
7
7
  hashie
@@ -58,7 +58,7 @@ GEM
58
58
  docile (1.1.5)
59
59
  dotenv (2.1.1)
60
60
  erubis (2.7.0)
61
- faraday (0.10.0)
61
+ faraday (0.10.1)
62
62
  multipart-post (>= 1.2, < 3)
63
63
  faraday_middleware (0.10.1)
64
64
  faraday (>= 0.7.4, < 1.0)
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: ../
3
3
  specs:
4
- routemaster-drain (2.2.1)
4
+ routemaster-drain (2.3.0)
5
5
  faraday (>= 0.9.0)
6
6
  faraday_middleware
7
7
  hashie
@@ -71,7 +71,7 @@ GEM
71
71
  docile (1.1.5)
72
72
  dotenv (2.1.1)
73
73
  erubis (2.7.0)
74
- faraday (0.10.0)
74
+ faraday (0.10.1)
75
75
  multipart-post (>= 1.2, < 3)
76
76
  faraday_middleware (0.10.1)
77
77
  faraday (>= 0.7.4, < 1.0)
@@ -1,5 +1,5 @@
1
1
  module Routemaster
2
2
  module Drain
3
- VERSION = '2.2.2'
3
+ VERSION = '2.3.0'
4
4
  end
5
5
  end
@@ -8,7 +8,10 @@ module Routemaster
8
8
  class CacheAndSweep
9
9
  def perform(url)
10
10
  Dirty::Map.new.sweep_one(url) do
11
- Cache.new.get(url)
11
+ begin
12
+ Cache.new.get(url)
13
+ rescue Errors::ResourceNotFound
14
+ end
12
15
  end
13
16
  end
14
17
  end
@@ -41,6 +41,10 @@ module Routemaster
41
41
  body.reject { |key, _| ['_links'].include?(key) }
42
42
  end
43
43
 
44
+ def has?(link)
45
+ _links.has_key?(link.to_s)
46
+ end
47
+
44
48
  private
45
49
 
46
50
  def _links
@@ -0,0 +1,26 @@
1
+ require 'routemaster/jobs/cache_and_sweep'
2
+ require 'spec_helper'
3
+
4
+ RSpec.describe Routemaster::Jobs::CacheAndSweep do
5
+ subject { described_class.new }
6
+
7
+ context 'when there is an ResourceNotFound error' do
8
+ before do
9
+ expect_any_instance_of(Routemaster::Cache).to receive(:get).and_raise(Routemaster::Errors::ResourceNotFound.new(""))
10
+ end
11
+
12
+ it 'does not bubble up the error' do
13
+ expect { subject.perform('url') }.to_not raise_error
14
+ end
15
+ end
16
+
17
+ context 'when there is any other error' do
18
+ before do
19
+ expect_any_instance_of(Routemaster::Cache).to receive(:get).and_raise("boom")
20
+ end
21
+
22
+ it 'does bubble up the error' do
23
+ expect { subject.perform('url') }.to raise_error("boom")
24
+ end
25
+ end
26
+ end
@@ -44,6 +44,16 @@ module Routemaster
44
44
  expect(subject.body_without_links).to eq({ 'foo' => 'bar' })
45
45
  end
46
46
  end
47
+
48
+ describe '#has?' do
49
+ it 'returns true for an existing link' do
50
+ expect(subject.has?(:resource_a)).to be_truthy
51
+ end
52
+
53
+ it 'returns false for a non existing link' do
54
+ expect(subject.has?(:other_resource)).to be_falsy
55
+ end
56
+ end
47
57
  end
48
58
  end
49
59
  end
data/spec/spec_helper.rb CHANGED
@@ -2,6 +2,9 @@ require 'simplecov'
2
2
  SimpleCov.start
3
3
 
4
4
  require 'byebug'
5
+ require 'sidekiq/testing'
6
+ require 'dotenv'
7
+ Dotenv.overload('.env.test')
5
8
 
6
9
  # This file was generated by the `rspec --init` command. Conventionally, all
7
10
  # specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: routemaster-drain
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.2.2
4
+ version: 2.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Julien Letessier
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-01-10 00:00:00.000000000 Z
11
+ date: 2017-01-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
@@ -196,6 +196,7 @@ files:
196
196
  - spec/routemaster/jobs/backends/backend_examples.rb
197
197
  - spec/routemaster/jobs/backends/resque_spec.rb
198
198
  - spec/routemaster/jobs/backends/sidekiq_spec.rb
199
+ - spec/routemaster/jobs/cache_and_sweep_spec.rb
199
200
  - spec/routemaster/jobs/client_spec.rb
200
201
  - spec/routemaster/middleware/authenticate_spec.rb
201
202
  - spec/routemaster/middleware/cache_spec.rb
@@ -252,6 +253,7 @@ test_files:
252
253
  - spec/routemaster/jobs/backends/backend_examples.rb
253
254
  - spec/routemaster/jobs/backends/resque_spec.rb
254
255
  - spec/routemaster/jobs/backends/sidekiq_spec.rb
256
+ - spec/routemaster/jobs/cache_and_sweep_spec.rb
255
257
  - spec/routemaster/jobs/client_spec.rb
256
258
  - spec/routemaster/middleware/authenticate_spec.rb
257
259
  - spec/routemaster/middleware/cache_spec.rb