garner 0.5.0 → 0.5.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (40) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +1 -30
  3. data/.rubocop_todo.yml +49 -0
  4. data/.travis.yml +2 -0
  5. data/CHANGELOG.md +6 -0
  6. data/Gemfile +1 -1
  7. data/README.md +2 -2
  8. data/garner.gemspec +2 -2
  9. data/lib/garner/cache.rb +1 -1
  10. data/lib/garner/strategies/binding/key/binding_index.rb +1 -1
  11. data/lib/garner/version.rb +1 -1
  12. data/spec/garner/cache/context_spec.rb +4 -4
  13. data/spec/garner/cache/identity_spec.rb +6 -6
  14. data/spec/garner/cache_spec.rb +14 -6
  15. data/spec/garner/config_spec.rb +1 -1
  16. data/spec/garner/mixins/mongoid/document_spec.rb +12 -12
  17. data/spec/garner/mixins/mongoid/identity_spec.rb +25 -25
  18. data/spec/garner/mixins/rack_spec.rb +6 -6
  19. data/spec/garner/strategies/binding/invalidation/binding_index_spec.rb +1 -1
  20. data/spec/garner/strategies/binding/invalidation/touch_spec.rb +3 -3
  21. data/spec/garner/strategies/binding/key/binding_index_spec.rb +44 -44
  22. data/spec/garner/strategies/binding/key/cache_key_spec.rb +2 -2
  23. data/spec/garner/strategies/binding/key/safe_cache_key_spec.rb +12 -12
  24. data/spec/garner/strategies/context/key/caller_spec.rb +17 -17
  25. data/spec/garner/strategies/context/key/jsonp_spec.rb +2 -2
  26. data/spec/garner/strategies/context/key/request_get_spec.rb +3 -3
  27. data/spec/garner/strategies/context/key/request_path_spec.rb +3 -3
  28. data/spec/garner/strategies/context/key/request_post_spec.rb +3 -3
  29. data/spec/garner/version_spec.rb +2 -2
  30. data/spec/integration/active_record_spec.rb +4 -4
  31. data/spec/integration/grape_spec.rb +1 -1
  32. data/spec/integration/mongoid_spec.rb +57 -57
  33. data/spec/integration/rack_spec.rb +7 -7
  34. data/spec/integration/sinatra_spec.rb +1 -1
  35. data/spec/shared/binding_invalidation_strategy.rb +1 -1
  36. data/spec/shared/binding_key_strategy.rb +4 -4
  37. data/spec/shared/conditional_get.rb +13 -13
  38. data/spec/shared/context_key_strategy.rb +2 -2
  39. data/spec/spec_helper.rb +1 -0
  40. metadata +8 -7
@@ -2,7 +2,7 @@ require 'spec_helper'
2
2
  require 'garner/mixins/rack'
3
3
  require 'sinatra'
4
4
 
5
- describe 'Sinatra integration' do
5
+ describe 'Sinatra integration', type: :request do
6
6
 
7
7
  let(:app) do
8
8
  class TestSinatraApp < Sinatra::Base
@@ -2,7 +2,7 @@
2
2
  # implement apply(binding) and force_apply(binding)
3
3
  shared_examples_for 'Garner::Strategies::Binding::Invalidation strategy' do
4
4
  it 'inherits from Garner::Strategies::Binding::Invalidation::Base' do
5
- subject.new.should be_a(Garner::Strategies::Binding::Invalidation::Base)
5
+ expect(subject.new).to be_a(Garner::Strategies::Binding::Invalidation::Base)
6
6
  end
7
7
 
8
8
  describe 'apply' do
@@ -6,13 +6,13 @@ shared_examples_for 'Garner::Strategies::Binding::Key strategy' do
6
6
  end
7
7
 
8
8
  it 'inherits from Garner::Strategies::Binding::Key::Base' do
9
- subject.new.should be_a(Garner::Strategies::Binding::Key::Base)
9
+ expect(subject.new).to be_a(Garner::Strategies::Binding::Key::Base)
10
10
  end
11
11
 
12
12
  describe 'given a known binding' do
13
13
  it 'returns a valid cache key' do
14
14
  known_bindings.each do |binding|
15
- subject.apply(binding).should be_a(String)
15
+ expect(subject.apply(binding)).to be_a(String)
16
16
  end
17
17
  end
18
18
 
@@ -20,7 +20,7 @@ shared_examples_for 'Garner::Strategies::Binding::Key strategy' do
20
20
  known_bindings.each do |binding|
21
21
  key1 = subject.apply(binding)
22
22
  key2 = subject.apply(binding)
23
- key1.should eq key2
23
+ expect(key1).to eq key2
24
24
  end
25
25
  end
26
26
  end
@@ -28,7 +28,7 @@ shared_examples_for 'Garner::Strategies::Binding::Key strategy' do
28
28
  describe 'given an unknown binding' do
29
29
  it 'returns a nil cache key' do
30
30
  unknown_bindings.each do |binding|
31
- subject.apply(binding).should be_nil
31
+ expect(subject.apply(binding)).to be_nil
32
32
  end
33
33
  end
34
34
  end
@@ -14,35 +14,35 @@ shared_examples_for 'Rack::ConditionalGet server' do
14
14
 
15
15
  it "writes the cached object's ETag from binding" do
16
16
  get '/'
17
- last_response.headers['ETag'].length.should eq 32 + 2
17
+ expect(last_response.headers['ETag'].length).to eq 32 + 2
18
18
  end
19
19
 
20
20
  it 'sends a 304 response if content has not changed (If-None-Match)' do
21
21
  get '/'
22
- last_response.status.should eq 200
23
- last_response.headers['ETag'].should eq %Q("#{etag_for(last_response.body)}")
22
+ expect(last_response.status).to eq 200
23
+ expect(last_response.headers['ETag']).to eq %("#{etag_for(last_response.body)}")
24
24
  get '/', {}, 'HTTP_IF_NONE_MATCH' => last_response.headers['ETag']
25
- last_response.status.should eq 304
25
+ expect(last_response.status).to eq 304
26
26
  end
27
27
 
28
28
  it 'sends a 200 response if content has changed (If-None-Match)' do
29
29
  get '/'
30
- last_response.status.should eq 200
31
- get '/', {}, 'HTTP_IF_NONE_MATCH' => %Q("#{etag_for('foobar')}")
32
- last_response.status.should eq 200
30
+ expect(last_response.status).to eq 200
31
+ get '/', {}, 'HTTP_IF_NONE_MATCH' => %("#{etag_for('foobar')}")
32
+ expect(last_response.status).to eq 200
33
33
  end
34
34
 
35
35
  it 'sends a 200 response if content has changed (valid If-Modified-Since but invalid If-None-Match)' do
36
36
  get '/'
37
- last_response.status.should eq 200
38
- get '/', {}, 'HTTP_IF_MODIFIED_SINCE' => (Time.now + 1).httpdate, 'HTTP_IF_NONE_MATCH' => %Q("#{etag_for(last_response.body)}")
39
- last_response.status.should eq 200
37
+ expect(last_response.status).to eq 200
38
+ get '/', {}, 'HTTP_IF_MODIFIED_SINCE' => (Time.now + 1).httpdate, 'HTTP_IF_NONE_MATCH' => %("#{etag_for(last_response.body)}")
39
+ expect(last_response.status).to eq 200
40
40
  end
41
41
 
42
42
  it 'adds Cache-Control, Pragma and Expires headers' do
43
43
  get '/'
44
- last_response.headers['Cache-Control'].split(', ').sort.should eq %w(max-age=0 must-revalidate private)
45
- last_response.headers['Pragma'].should be_nil
46
- Time.parse(last_response.headers['Expires']).should be < Time.now
44
+ expect(last_response.headers['Cache-Control'].split(', ').sort).to eq %w(max-age=0 must-revalidate private)
45
+ expect(last_response.headers['Pragma']).to be_nil
46
+ expect(Time.parse(last_response.headers['Expires'])).to be < Time.now
47
47
  end
48
48
  end
@@ -6,7 +6,7 @@ shared_examples_for 'Garner::Strategies::Context::Key strategy' do
6
6
  end
7
7
 
8
8
  it 'inherits from Garner::Strategies::Context::Key::Base' do
9
- subject.new.should be_a(Garner::Strategies::Context::Key::Base)
9
+ expect(subject.new).to be_a(Garner::Strategies::Context::Key::Base)
10
10
  end
11
11
 
12
12
  it 'requires a Garner::Cache::Identity' do
@@ -19,6 +19,6 @@ shared_examples_for 'Garner::Strategies::Context::Key strategy' do
19
19
 
20
20
  it 'returns a Garner::Cache::Identity' do
21
21
  modified_identity = subject.apply(@cache_identity, self)
22
- modified_identity.should eq @cache_identity
22
+ expect(modified_identity).to eq @cache_identity
23
23
  end
24
24
  end
@@ -18,6 +18,7 @@ Dir["#{File.dirname(__FILE__)}/shared/*.rb"].each do |file|
18
18
  end
19
19
 
20
20
  RSpec.configure do |rspec|
21
+ rspec.raise_errors_for_deprecations!
21
22
  rspec.mock_with :rspec do |mocks|
22
23
  mocks.patch_marshal_to_support_partial_doubles = true
23
24
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: garner
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.5.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Daniel Doubrovkine
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-07-17 00:00:00.000000000 Z
12
+ date: 2014-11-26 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rack
@@ -87,14 +87,14 @@ dependencies:
87
87
  requirements:
88
88
  - - ~>
89
89
  - !ruby/object:Gem::Version
90
- version: '2.10'
90
+ version: '3.1'
91
91
  type: :development
92
92
  prerelease: false
93
93
  version_requirements: !ruby/object:Gem::Requirement
94
94
  requirements:
95
95
  - - ~>
96
96
  - !ruby/object:Gem::Version
97
- version: '2.10'
97
+ version: '3.1'
98
98
  - !ruby/object:Gem::Dependency
99
99
  name: bundler
100
100
  requirement: !ruby/object:Gem::Requirement
@@ -255,14 +255,14 @@ dependencies:
255
255
  requirements:
256
256
  - - '='
257
257
  - !ruby/object:Gem::Version
258
- version: 0.24.1
258
+ version: 0.27.1
259
259
  type: :development
260
260
  prerelease: false
261
261
  version_requirements: !ruby/object:Gem::Requirement
262
262
  requirements:
263
263
  - - '='
264
264
  - !ruby/object:Gem::Version
265
- version: 0.24.1
265
+ version: 0.27.1
266
266
  description:
267
267
  email:
268
268
  - dblock@dblock.org
@@ -279,6 +279,7 @@ files:
279
279
  - .gitignore
280
280
  - .rspec
281
281
  - .rubocop.yml
282
+ - .rubocop_todo.yml
282
283
  - .travis.yml
283
284
  - CHANGELOG.md
284
285
  - CONTRIBUTING.md
@@ -370,7 +371,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
370
371
  version: '0'
371
372
  requirements: []
372
373
  rubyforge_project:
373
- rubygems_version: 2.0.14
374
+ rubygems_version: 2.1.11
374
375
  signing_key:
375
376
  specification_version: 4
376
377
  summary: Garner is a cache layer for Ruby and Rack applications, supporting model