-
Notifications
You must be signed in to change notification settings - Fork 66
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into 78798-add-brd-test
- Loading branch information
Showing
19 changed files
with
104 additions
and
54 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,5 +21,6 @@ production: | |
- [email protected] | ||
- [email protected] | ||
- [email protected] | ||
- [email protected] | ||
- [email protected] | ||
- [email protected] |
21 changes: 21 additions & 0 deletions
21
modules/ask_va_api/app/services/ask_va_api/redis_client.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# frozen_string_literal: true | ||
|
||
module AskVAApi | ||
class RedisClient | ||
def fetch(key) | ||
Rails.cache.read( | ||
key, | ||
namespace: 'crm-api-cache' | ||
) | ||
end | ||
|
||
def store_data(key:, data:, ttl:) | ||
Rails.cache.write( | ||
key, | ||
data, | ||
namespace: 'crm-api-cache', | ||
expires_in: ttl | ||
) | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -62,12 +62,18 @@ | |
|
||
describe '#save' do | ||
it 'saves serialized class to redis with the correct namespace' do | ||
expect_any_instance_of(Redis).to receive(:set).once.with( | ||
'my_namespace:e66fd7b7-94e0-4748-8063-283f55efb0ea', | ||
expect_any_instance_of(Redis::Namespace).to receive(:set).once.with( | ||
'e66fd7b7-94e0-4748-8063-283f55efb0ea', | ||
'{":uuid":"e66fd7b7-94e0-4748-8063-283f55efb0ea",":email":"[email protected]"}' | ||
) | ||
subject.save | ||
end | ||
|
||
it 'saves entry with namespace' do | ||
subject.save | ||
|
||
expect(subject.redis_namespace.redis.keys).to include('my_namespace:e66fd7b7-94e0-4748-8063-283f55efb0ea') | ||
end | ||
end | ||
|
||
describe '#update' do | ||
|
@@ -92,12 +98,18 @@ | |
|
||
describe '#destroy' do | ||
it 'removes itself from redis with the correct namespace' do | ||
expect_any_instance_of(Redis).to receive(:del).once.with( | ||
'my_namespace:e66fd7b7-94e0-4748-8063-283f55efb0ea' | ||
expect_any_instance_of(Redis::Namespace).to receive(:del).once.with( | ||
'e66fd7b7-94e0-4748-8063-283f55efb0ea' | ||
) | ||
subject.destroy | ||
end | ||
|
||
it "entry doesn't exists" do | ||
subject.destroy | ||
|
||
expect(subject.redis_namespace.redis.keys).not_to include('my_namespace:e66fd7b7-94e0-4748-8063-283f55efb0ea') | ||
end | ||
|
||
it 'freezes the instance after destroy is called' do | ||
subject.destroy | ||
expect(subject.destroyed?).to eq(true) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters