Skip to content

Commit 63c6097

Browse files
committed
styling
1 parent 0e685d8 commit 63c6097

File tree

1 file changed

+21
-13
lines changed

1 file changed

+21
-13
lines changed

spec/cacheable_spec.rb

Lines changed: 21 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -209,22 +209,25 @@ def self.with_expiry
209209
it 'calls Rails.cache with the proper cache key' do
210210
expect(Rails.cache).to receive(:fetch).with(
211211
"#{Cacheable::CacheVersion.get}:#{instance_1.class.name}:#{instance_1.object_id}:more_arguments:0:1",
212-
expires_in: cache_duration)
212+
expires_in: cache_duration
213+
)
213214
instance_1.more_arguments(0, 1)
214215
end
215216

216217
it 'calls Rails.cache with the proper cache key with updated_at' do
217218
expect(Rails.cache).to receive(:fetch).with(
218219
"#{Cacheable::CacheVersion.get}:#{instance_1.class.name}:#{instance_1.object_id}:#{Date.today}:more_arguments:0:1",
219-
expires_in: cache_duration)
220-
instance_1.updated_at = Date.today
220+
expires_in: cache_duration
221+
)
222+
instance_1.updated_at = Date.today
221223
instance_1.more_arguments(0, 1)
222224
end
223225

224226
it 'calls Rails.cache with the proper cache duration' do
225227
expect(Rails.cache).to receive(:fetch).with(
226228
"#{Cacheable::CacheVersion.get}:#{instance_1.class.name}:#{instance_1.object_id}:with_expiry:",
227-
expires_in: 5.minutes)
229+
expires_in: 5.minutes
230+
)
228231
instance_1.with_expiry
229232
end
230233

@@ -286,25 +289,29 @@ def instance_1.id
286289

287290
it 'will cache the class method if there is an instance method with same name' do
288291
expect(instance_2.a_class_method).to eq(
289-
"This is an instance method but the name is same as one of class's methods")
292+
"This is an instance method but the name is same as one of class's methods"
293+
)
290294
end
291295

292296
it 'calls Rails.cache with the expected arguments' do
293297
expect(Rails.cache).to receive(:fetch).with(
294-
"#{Cacheable::CacheVersion.get}:#{CacheableClass2.name}:a_class_method:x:y", expires_in: cache_duration)
295-
CacheableClass2.a_class_method_with_cache('x', 'y')
298+
"#{Cacheable::CacheVersion.get}:#{CacheableClass2.name}:a_class_method:x:y", expires_in: cache_duration
299+
)
300+
CacheableClass2.a_class_method('x', 'y')
296301
end
297302

298303
it 'calls Rails.cache with the expected arguments with locale' do
299304
expect(Rails.cache).to receive(:fetch).with(
300-
"#{Cacheable::CacheVersion.get}:#{CacheableClass2.name}:method_with_locale:3:1:en", expires_in: cache_duration)
301-
CacheableClass2.method_with_locale_with_cache(3, 1)
305+
"#{Cacheable::CacheVersion.get}:#{CacheableClass2.name}:method_with_locale:3:1:en", expires_in: cache_duration
306+
)
307+
CacheableClass2.method_with_locale(3, 1)
302308
end
303309

304310
it 'calls Rails.cache with the provided duration' do
305311
expect(Rails.cache).to receive(:fetch).with(
306312
"#{Cacheable::CacheVersion.get}:#{CacheableClass2.name}:with_expiry:",
307-
expires_in: 6.minutes)
313+
expires_in: 6.minutes
314+
)
308315
CacheableClass2.with_expiry
309316
end
310317

@@ -347,10 +354,11 @@ def instance_1.id
347354

348355
describe 'delete_cache' do
349356
it 'calls Rails.cache.delete' do
350-
CacheableClass2.method_3(4,5)
357+
CacheableClass2.method_3(4, 5)
351358
expect(Rails.cache).to receive(:delete).with(
352-
"#{Cacheable::CacheVersion.get}:#{CacheableClass2.name}:method_3:4:5")
353-
CacheableClass2.delete_method_3_cache(4,5)
359+
"#{Cacheable::CacheVersion.get}:#{CacheableClass2.name}:method_3:4:5"
360+
)
361+
CacheableClass2.delete_method_3_cache(4, 5)
354362
end
355363
end
356364
end

0 commit comments

Comments
 (0)