Skip to content

Commit

Permalink
improve test coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
Karl-H committed Sep 26, 2024
1 parent 9e8a7ce commit 5f721b7
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions spec/cache_store_redis_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,19 @@
expect(v).to eq(value)
end

it 'should add a string to the cache store and retrieve it (java platform)' do
original_platform = RUBY_PLATFORM
key = SecureRandom.uuid
value = 'value123'
Object.const_set(:RUBY_PLATFORM, 'java')
subject.public_send(method_name, key, value)

v = subject.get(key)

expect(v).to eq(value)
Object.const_set(:RUBY_PLATFORM, original_platform)
end

it 'should add an object to the cache store and retrieve it' do
key = SecureRandom.uuid
value = TestObject.new
Expand All @@ -57,6 +70,24 @@
expect(v.numeric).to eq(value.numeric)
end

it 'should add an object to the cache store and retrieve it (java platform)' do
original_platform = RUBY_PLATFORM
key = SecureRandom.uuid
value = TestObject.new
value.text = 'abc123'
value.numeric = 123
Object.const_set(:RUBY_PLATFORM, 'java')

subject.public_send(method_name, key, value)

v = subject.get(key)

expect(v.class).to eq(TestObject)
expect(v.text).to eq(value.text)
expect(v.numeric).to eq(value.numeric)
Object.const_set(:RUBY_PLATFORM, original_platform)
end

it 'should run the hydration block when the requested key does not exist in the cache' do
key = SecureRandom.uuid

Expand Down

0 comments on commit 5f721b7

Please sign in to comment.