garner 0.5.0 → 0.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
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
@@ -22,17 +22,17 @@ describe Garner::Mixins::Rack do
22
22
  end
23
23
 
24
24
  it 'returns a Garner::Cache::Identity' do
25
- subject.call.should be_a(Garner::Cache::Identity)
25
+ expect(subject.call).to be_a(Garner::Cache::Identity)
26
26
  end
27
27
 
28
28
  it "sets the identity's ruby_binding to self" do
29
- subject.call.ruby_context.should eq @mock_app
29
+ expect(subject.call.ruby_context).to eq @mock_app
30
30
  end
31
31
 
32
32
  it 'applies each of Garner.config.rack_context_key_strategies' do
33
33
  # Default :context_key_strategies
34
- subject.call.key_hash[:caller].should_not be_nil
35
- subject.call.key_hash[:request_params].should eq('foo' => 'bar')
34
+ expect(subject.call.key_hash[:caller]).not_to be_nil
35
+ expect(subject.call.key_hash[:request_params]).to eq('foo' => 'bar')
36
36
 
37
37
  # Custom :context_key_strategies
38
38
  Garner.configure do |config|
@@ -40,8 +40,8 @@ describe Garner::Mixins::Rack do
40
40
  Garner::Strategies::Context::Key::RequestGet
41
41
  ]
42
42
  end
43
- subject.call.key_hash[:caller].should be_nil
44
- subject.call.key_hash[:request_params].should eq('foo' => 'bar')
43
+ expect(subject.call.key_hash[:caller]).to be_nil
44
+ expect(subject.call.key_hash[:request_params]).to eq('foo' => 'bar')
45
45
  end
46
46
 
47
47
  end
@@ -4,7 +4,7 @@ describe Garner::Strategies::Binding::Invalidation::BindingIndex do
4
4
 
5
5
  before(:each) do
6
6
  @mock = double('model')
7
- @mock.stub(:touch)
7
+ allow(@mock).to receive(:touch)
8
8
  end
9
9
 
10
10
  subject { Garner::Strategies::Binding::Invalidation::BindingIndex }
@@ -4,7 +4,7 @@ describe Garner::Strategies::Binding::Invalidation::Touch do
4
4
 
5
5
  before(:each) do
6
6
  @mock = double('model')
7
- @mock.stub(:touch)
7
+ allow(@mock).to receive(:touch)
8
8
  end
9
9
 
10
10
  subject { Garner::Strategies::Binding::Invalidation::Touch }
@@ -12,12 +12,12 @@ describe Garner::Strategies::Binding::Invalidation::Touch do
12
12
  it_behaves_like 'Garner::Strategies::Binding::Invalidation strategy'
13
13
 
14
14
  it 'calls :touch on the object' do
15
- @mock.should_receive(:touch)
15
+ expect(@mock).to receive(:touch)
16
16
  subject.apply(@mock)
17
17
  end
18
18
 
19
19
  it 'does not raise error if :touch is undefined' do
20
- @mock.unstub(:touch)
20
+ allow(@mock).to receive(:touch)
21
21
  expect { subject.apply(@mock) }.to_not raise_error
22
22
  end
23
23
  end
@@ -6,21 +6,21 @@ describe Garner::Strategies::Binding::Key::BindingIndex do
6
6
  @new_mock = double('new_mock')
7
7
 
8
8
  @persisted_mock = double('persisted_mock')
9
- @persisted_mock.stub(:identity_string) { 'Mocker/id=4' }
10
- @persisted_mock.stub(:updated_at) { @time_dot_now }
9
+ allow(@persisted_mock).to receive(:identity_string) { 'Mocker/id=4' }
10
+ allow(@persisted_mock).to receive(:updated_at) { @time_dot_now }
11
11
 
12
12
  @persisted_mock_alias = double('persisted_mock_alias')
13
- @persisted_mock_alias.stub(:identity_string) { 'MockerAlias/id=alias-4' }
14
- @persisted_mock_alias.stub(:proxy_binding) { @persisted_mock }
13
+ allow(@persisted_mock_alias).to receive(:identity_string) { 'MockerAlias/id=alias-4' }
14
+ allow(@persisted_mock_alias).to receive(:proxy_binding) { @persisted_mock }
15
15
 
16
- subject.stub(:canonical?) do |binding|
16
+ allow(subject).to receive(:canonical?) do |binding|
17
17
  binding == @persisted_mock
18
18
  end
19
19
 
20
20
  # Marshal.load will return a new mock object, breaking equivalence tests
21
21
  # when fetching from cache.
22
22
  load_method = Marshal.method(:load)
23
- Marshal.stub(:load) do |dump|
23
+ allow(Marshal).to receive(:load) do |dump|
24
24
  default = load_method.call(dump)
25
25
  if default.is_a?(RSpec::Mocks::Double) &&
26
26
  default.instance_variable_get(:@name) == 'persisted_mock'
@@ -34,7 +34,7 @@ describe Garner::Strategies::Binding::Key::BindingIndex do
34
34
  @mock_key = 'cc318d04bac07d5d91f06f8c'
35
35
  @mock_alias_key = 'f254b853d7b32406b5749410'
36
36
  @random_key = 'b1d44bb6b369903b28549271'
37
- subject.stub(:new_cache_key_for) do |binding|
37
+ allow(subject).to receive(:new_cache_key_for) do |binding|
38
38
  if binding == @persisted_mock
39
39
  @mock_key
40
40
  elsif binding == @persisted_mock_alias
@@ -54,7 +54,7 @@ describe Garner::Strategies::Binding::Key::BindingIndex do
54
54
 
55
55
  describe 'apply' do
56
56
  it 'calls fetch_cache_key_for' do
57
- subject.should_receive(:fetch_cache_key_for).with(@persisted_mock)
57
+ expect(subject).to receive(:fetch_cache_key_for).with(@persisted_mock)
58
58
  subject.apply(@persisted_mock)
59
59
  end
60
60
  end
@@ -62,54 +62,54 @@ describe Garner::Strategies::Binding::Key::BindingIndex do
62
62
  describe 'fetch_cache_key_for' do
63
63
  context 'with a canonical binding' do
64
64
  it 'returns a cache key string' do
65
- subject.fetch_cache_key_for(@persisted_mock).should eq @mock_key
65
+ expect(subject.fetch_cache_key_for(@persisted_mock)).to eq @mock_key
66
66
  end
67
67
 
68
68
  it 'stores the cache key to cache' do
69
69
  subject.fetch_cache_key_for(@persisted_mock)
70
- Garner.config.cache.read(
70
+ expect(Garner.config.cache.read(
71
71
  strategy: subject,
72
72
  proxied_binding: 'Mocker/id=4'
73
- ).should eq @mock_key
73
+ )).to eq @mock_key
74
74
  end
75
75
  end
76
76
 
77
77
  context 'with a non-canonical binding' do
78
78
  it 'returns a cache key string' do
79
- subject.fetch_cache_key_for(@persisted_mock_alias).should eq @mock_key
79
+ expect(subject.fetch_cache_key_for(@persisted_mock_alias)).to eq @mock_key
80
80
  end
81
81
 
82
82
  it 'stores the canonical binding to cache' do
83
83
  subject.fetch_cache_key_for(@persisted_mock_alias)
84
- Garner.config.cache.read(
84
+ expect(Garner.config.cache.read(
85
85
  strategy: subject,
86
86
  proxied_binding: 'MockerAlias/id=alias-4'
87
- ).should eq @persisted_mock
87
+ )).to eq @persisted_mock
88
88
  end
89
89
 
90
90
  it 'stores the cache key to cache' do
91
91
  subject.fetch_cache_key_for(@persisted_mock_alias)
92
- Garner.config.cache.read(
92
+ expect(Garner.config.cache.read(
93
93
  strategy: subject,
94
94
  proxied_binding: 'Mocker/id=4'
95
- ).should eq @mock_key
95
+ )).to eq @mock_key
96
96
  end
97
97
 
98
98
  context 'whose canonical binding is nil' do
99
99
  before(:each) do
100
- @persisted_mock_alias.stub(:proxy_binding) { nil }
100
+ allow(@persisted_mock_alias).to receive(:proxy_binding) { nil }
101
101
  end
102
102
 
103
103
  it 'returns a nil cache key' do
104
- subject.fetch_cache_key_for(@persisted_mock_alias).should be_nil
104
+ expect(subject.fetch_cache_key_for(@persisted_mock_alias)).to be_nil
105
105
  end
106
106
 
107
107
  it 'does not store the cache key to cache' do
108
108
  subject.fetch_cache_key_for(@persisted_mock_alias)
109
- Garner.config.cache.read(
109
+ expect(Garner.config.cache.read(
110
110
  strategy: subject,
111
111
  proxied_binding: ''
112
- ).should be_nil
112
+ )).to be_nil
113
113
  end
114
114
  end
115
115
  end
@@ -118,22 +118,22 @@ describe Garner::Strategies::Binding::Key::BindingIndex do
118
118
  describe 'write_cache_key_for' do
119
119
  context 'with a canonical binding' do
120
120
  it 'returns a cache key string' do
121
- subject.write_cache_key_for(@persisted_mock).should eq @mock_key
121
+ expect(subject.write_cache_key_for(@persisted_mock)).to eq @mock_key
122
122
  end
123
123
  end
124
124
 
125
125
  context 'with a non-canonical binding' do
126
126
  it 'returns a cache key string' do
127
- subject.write_cache_key_for(@persisted_mock_alias).should eq @mock_key
127
+ expect(subject.write_cache_key_for(@persisted_mock_alias)).to eq @mock_key
128
128
  end
129
129
 
130
130
  context 'whose canonical binding is nil' do
131
131
  before(:each) do
132
- @persisted_mock_alias.stub(:proxy_binding) { nil }
132
+ allow(@persisted_mock_alias).to receive(:proxy_binding) { nil }
133
133
  end
134
134
 
135
135
  it 'returns a nil cache key' do
136
- subject.write_cache_key_for(@persisted_mock_alias).should be_nil
136
+ expect(subject.write_cache_key_for(@persisted_mock_alias)).to be_nil
137
137
  end
138
138
  end
139
139
  end
@@ -142,27 +142,27 @@ describe Garner::Strategies::Binding::Key::BindingIndex do
142
142
  describe 'fetch_canonical_binding_for' do
143
143
  context 'with a canonical binding' do
144
144
  it 'returns the canonical binding' do
145
- subject.fetch_canonical_binding_for(@persisted_mock).should eq @persisted_mock
145
+ expect(subject.fetch_canonical_binding_for(@persisted_mock)).to eq @persisted_mock
146
146
  end
147
147
  end
148
148
 
149
149
  context 'with a non-canonical binding' do
150
150
  it 'returns the canonical binding' do
151
- subject.fetch_canonical_binding_for(@persisted_mock_alias).should eq @persisted_mock
151
+ expect(subject.fetch_canonical_binding_for(@persisted_mock_alias)).to eq @persisted_mock
152
152
  end
153
153
 
154
154
  it 'stores the canonical binding to cache' do
155
155
  subject.fetch_canonical_binding_for(@persisted_mock_alias)
156
- Garner.config.cache.read(
156
+ expect(Garner.config.cache.read(
157
157
  strategy: subject,
158
158
  proxied_binding: 'MockerAlias/id=alias-4'
159
- ).should eq @persisted_mock
159
+ )).to eq @persisted_mock
160
160
  end
161
161
  end
162
162
 
163
163
  context 'with a proxyless binding' do
164
164
  it 'returns nil' do
165
- subject.fetch_canonical_binding_for(@new_mock).should.nil?
165
+ expect(subject.fetch_canonical_binding_for(@new_mock)).to be nil
166
166
  end
167
167
  end
168
168
  end
@@ -170,27 +170,27 @@ describe Garner::Strategies::Binding::Key::BindingIndex do
170
170
  describe 'write_canonical_binding_for' do
171
171
  context 'with a canonical binding' do
172
172
  it 'returns the canonical binding' do
173
- subject.write_canonical_binding_for(@persisted_mock).should eq @persisted_mock
173
+ expect(subject.write_canonical_binding_for(@persisted_mock)).to eq @persisted_mock
174
174
  end
175
175
  end
176
176
 
177
177
  context 'with a non-canonical binding' do
178
178
  it 'returns the canonical binding' do
179
- subject.write_canonical_binding_for(@persisted_mock_alias).should eq @persisted_mock
179
+ expect(subject.write_canonical_binding_for(@persisted_mock_alias)).to eq @persisted_mock
180
180
  end
181
181
  end
182
182
 
183
183
  context 'with a proxyless binding' do
184
184
  it 'returns nil' do
185
- subject.write_canonical_binding_for(@new_mock).should.nil?
185
+ expect(subject.write_canonical_binding_for(@new_mock)).to be nil
186
186
  end
187
187
  end
188
188
  end
189
189
 
190
190
  context 'with real objects' do
191
191
  before(:each) do
192
- subject.unstub(:canonical?)
193
- subject.unstub(:new_cache_key_for)
192
+ allow(subject).to receive(:canonical?).and_call_original
193
+ allow(subject).to receive(:new_cache_key_for).and_call_original
194
194
  Garner.configure do |config|
195
195
  config.mongoid_identity_fields = [:_id, :_slugs]
196
196
  end
@@ -212,33 +212,33 @@ describe Garner::Strategies::Binding::Key::BindingIndex do
212
212
  describe 'apply' do
213
213
  it 'retrieves the correct key' do
214
214
  key = subject.apply(Cheese.find('m1'))
215
- subject.apply(Cheese.identify('m1')).should eq key
215
+ expect(subject.apply(Cheese.identify('m1'))).to eq key
216
216
  end
217
217
 
218
218
  it 'stores the appropriate values to cache' do
219
219
  key1 = subject.apply(Food.identify(@cheese.id))
220
220
  key2 = subject.apply(Cheese.identify('m1'))
221
- key1.should eq key2
221
+ expect(key1).to eq key2
222
222
 
223
- Garner.config.cache.read(
223
+ expect(Garner.config.cache.read(
224
224
  strategy: subject,
225
225
  proxied_binding: "Garner::Mixins::Mongoid::Identity/klass=Food,handle=#{@cheese.id}"
226
- ).should eq @cheese
226
+ )).to eq @cheese
227
227
 
228
- Garner.config.cache.read(
228
+ expect(Garner.config.cache.read(
229
229
  strategy: subject,
230
230
  proxied_binding: 'Garner::Mixins::Mongoid::Identity/klass=Cheese,handle=m1'
231
- ).should eq @cheese
231
+ )).to eq @cheese
232
232
 
233
- Garner.config.cache.read(
233
+ expect(Garner.config.cache.read(
234
234
  strategy: subject,
235
235
  proxied_binding: "Cheese/id=#{@cheese.id}"
236
- ).should eq key1
236
+ )).to eq key1
237
237
 
238
- Garner.config.cache.read(
238
+ expect(Garner.config.cache.read(
239
239
  strategy: subject,
240
240
  proxied_binding: "Food/id=#{@cheese.id}"
241
- ).should be_nil
241
+ )).to be_nil
242
242
  end
243
243
  end
244
244
  end
@@ -4,7 +4,7 @@ describe Garner::Strategies::Binding::Key::CacheKey do
4
4
 
5
5
  before(:each) do
6
6
  @mock = double('model')
7
- @mock.stub(:cache_key) { 'mocks/4' }
7
+ allow(@mock).to receive(:cache_key) { 'mocks/4' }
8
8
  end
9
9
 
10
10
  subject { Garner::Strategies::Binding::Key::CacheKey }
@@ -16,7 +16,7 @@ describe Garner::Strategies::Binding::Key::CacheKey do
16
16
 
17
17
  describe 'apply' do
18
18
  it "returns the object's cache key, or nil" do
19
- subject.apply(@mock).should eq 'mocks/4'
19
+ expect(subject.apply(@mock)).to eq 'mocks/4'
20
20
  end
21
21
  end
22
22
 
@@ -4,11 +4,11 @@ describe Garner::Strategies::Binding::Key::SafeCacheKey do
4
4
 
5
5
  before(:each) do
6
6
  @new_mock = double('model')
7
- @new_mock.stub(:cache_key) { 'mocks/4' }
7
+ allow(@new_mock).to receive(:cache_key) { 'mocks/4' }
8
8
  @persisted_mock = double('model')
9
9
  @time_dot_now = Time.now
10
- @persisted_mock.stub(:cache_key) { "mocks/4-#{@time_dot_now.utc.to_s(:number)}" }
11
- @persisted_mock.stub(:updated_at) { @time_dot_now }
10
+ allow(@persisted_mock).to receive(:cache_key) { "mocks/4-#{@time_dot_now.utc.to_s(:number)}" }
11
+ allow(@persisted_mock).to receive(:updated_at) { @time_dot_now }
12
12
  end
13
13
 
14
14
  subject { Garner::Strategies::Binding::Key::SafeCacheKey }
@@ -21,21 +21,21 @@ describe Garner::Strategies::Binding::Key::SafeCacheKey do
21
21
  describe 'apply' do
22
22
  it "returns the object's cache key + milliseconds if defined" do
23
23
  timestamp = @time_dot_now.utc.to_s(:number)
24
- subject.apply(@persisted_mock).should =~ /^mocks\/4-#{timestamp}.[0-9]{10}$/
24
+ expect(subject.apply(@persisted_mock)).to match(/^mocks\/4-#{timestamp}.[0-9]{10}$/)
25
25
  end
26
26
 
27
27
  it 'returns nil if :cache_key is undefined or nil' do
28
- @persisted_mock.unstub(:cache_key)
29
- subject.apply(@persisted_mock).should be_nil
30
- @persisted_mock.stub(:cache_key) { nil }
31
- subject.apply(@persisted_mock).should be_nil
28
+ allow(@persisted_mock).to receive(:cache_key)
29
+ expect(subject.apply(@persisted_mock)).to be_nil
30
+ allow(@persisted_mock).to receive(:cache_key) { nil }
31
+ expect(subject.apply(@persisted_mock)).to be_nil
32
32
  end
33
33
 
34
34
  it 'returns nil if :updated_at is undefined or nil' do
35
- @persisted_mock.unstub(:updated_at)
36
- subject.apply(@persisted_mock).should be_nil
37
- @persisted_mock.stub(:updated_at) { nil }
38
- subject.apply(@persisted_mock).should be_nil
35
+ allow(@persisted_mock).to receive(:updated_at)
36
+ expect(subject.apply(@persisted_mock)).to be_nil
37
+ allow(@persisted_mock).to receive(:updated_at) { nil }
38
+ expect(subject.apply(@persisted_mock)).to be_nil
39
39
  end
40
40
  end
41
41
 
@@ -11,21 +11,21 @@ describe Garner::Strategies::Context::Key::Caller do
11
11
  it_behaves_like 'Garner::Strategies::Context::Key strategy'
12
12
 
13
13
  it 'ignores nil caller' do
14
- @mock_context.stub(:caller) { nil }
14
+ allow(@mock_context).to receive(:caller) { nil }
15
15
  subject.apply(@cache_identity, @mock_context)
16
- @cache_identity.key_hash[:caller].should be_nil
16
+ expect(@cache_identity.key_hash[:caller]).to be_nil
17
17
  end
18
18
 
19
19
  it 'ignores nil caller location' do
20
- @mock_context.stub(:caller) { [nil] }
20
+ allow(@mock_context).to receive(:caller) { [nil] }
21
21
  subject.apply(@cache_identity, @mock_context)
22
- @cache_identity.key_hash[:caller].should be_nil
22
+ expect(@cache_identity.key_hash[:caller]).to be_nil
23
23
  end
24
24
 
25
25
  it 'ignores blank caller location' do
26
- @mock_context.stub(:caller) { [''] }
26
+ allow(@mock_context).to receive(:caller) { [''] }
27
27
  subject.apply(@cache_identity, @mock_context)
28
- @cache_identity.key_hash[:caller].should be_nil
28
+ expect(@cache_identity.key_hash[:caller]).to be_nil
29
29
  end
30
30
 
31
31
  context 'with default Garner.config.caller_root' do
@@ -35,17 +35,17 @@ describe Garner::Strategies::Context::Key::Caller do
35
35
  end
36
36
 
37
37
  it 'sets default_root to the nearest ancestor with a Gemfile' do
38
- subject.default_root.should eq @gemfile_root
38
+ expect(subject.default_root).to eq @gemfile_root
39
39
  end
40
40
 
41
41
  it 'sets Garner.config.caller_root to the nearest ancestor with a Gemfile' do
42
- Garner.config.caller_root.should eq @gemfile_root
42
+ expect(Garner.config.caller_root).to eq @gemfile_root
43
43
  end
44
44
 
45
45
  it 'sets an appropriate value for :caller' do
46
46
  truncated = __FILE__.gsub(@gemfile_root + File::SEPARATOR, '')
47
47
  subject.apply(@cache_identity, self)
48
- @cache_identity.key_hash[:caller].should eq "#{truncated}:#{__LINE__ - 1}"
48
+ expect(@cache_identity.key_hash[:caller]).to eq "#{truncated}:#{__LINE__ - 1}"
49
49
  end
50
50
  end
51
51
 
@@ -53,21 +53,21 @@ describe Garner::Strategies::Context::Key::Caller do
53
53
  before(:each) do
54
54
  class Rails
55
55
  end
56
- Rails.stub(:root) { Pathname.new(File.dirname(__FILE__)) }
56
+ allow(Rails).to receive(:root) { Pathname.new(File.dirname(__FILE__)) }
57
57
  end
58
58
 
59
59
  it 'sets default_root to Rails.root' do
60
- subject.default_root.should eq ::Rails.root.realpath.to_s
60
+ expect(subject.default_root).to eq ::Rails.root.realpath.to_s
61
61
  end
62
62
 
63
63
  it 'sets Garner.config.caller_root to Rails.root' do
64
- Garner.config.caller_root.should eq ::Rails.root.realpath.to_s
64
+ expect(Garner.config.caller_root).to eq ::Rails.root.realpath.to_s
65
65
  end
66
66
 
67
67
  it 'sets an appropriate value for :caller' do
68
68
  truncated = File.basename(__FILE__)
69
69
  subject.apply(@cache_identity, self)
70
- @cache_identity.key_hash[:caller].should eq "#{truncated}:#{__LINE__ - 1}"
70
+ expect(@cache_identity.key_hash[:caller]).to eq "#{truncated}:#{__LINE__ - 1}"
71
71
  end
72
72
  end
73
73
 
@@ -81,7 +81,7 @@ describe Garner::Strategies::Context::Key::Caller do
81
81
  it 'sets an appropriate value for :caller' do
82
82
  truncated = File.basename(__FILE__)
83
83
  subject.apply(@cache_identity, self)
84
- @cache_identity.key_hash[:caller].should eq "#{truncated}:#{__LINE__ - 1}"
84
+ expect(@cache_identity.key_hash[:caller]).to eq "#{truncated}:#{__LINE__ - 1}"
85
85
  end
86
86
  end
87
87
 
@@ -94,13 +94,13 @@ describe Garner::Strategies::Context::Key::Caller do
94
94
 
95
95
  it 'sets an appropriate value for :caller' do
96
96
  subject.apply(@cache_identity, self)
97
- @cache_identity.key_hash[:caller].should eq "#{__FILE__}:#{__LINE__ - 1}"
97
+ expect(@cache_identity.key_hash[:caller]).to eq "#{__FILE__}:#{__LINE__ - 1}"
98
98
  end
99
99
 
100
100
  it "doesn't require ActiveSupport" do
101
- String.any_instance.stub(:blank?) { fail NoMethodError.new }
101
+ allow_any_instance_of(String).to receive(:blank?) { fail NoMethodError.new }
102
102
  subject.apply(@cache_identity, self)
103
- @cache_identity.key_hash[:caller].should eq "#{__FILE__}:#{__LINE__ - 1}"
103
+ expect(@cache_identity.key_hash[:caller]).to eq "#{__FILE__}:#{__LINE__ - 1}"
104
104
  end
105
105
  end
106
106
  end