-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #72 from alphagov/vertex-client
Add Discovery Engine API client to application
- Loading branch information
Showing
4 changed files
with
107 additions
and
4 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
34 changes: 34 additions & 0 deletions
34
spec/lib/repositories/google_discovery_engine/repository_spec.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,34 @@ | ||
require "repositories/google_discovery_engine/repository" | ||
|
||
# Require v1 specifically to instance_double it (repository itself uses non-versioned API) | ||
require "google/cloud/discovery_engine/v1" | ||
|
||
RSpec.describe Repositories::GoogleDiscoveryEngine::Repository do | ||
let(:repository) { described_class.new(client:, logger:) } | ||
let(:client) { instance_double(Google::Cloud::DiscoveryEngine::V1::DocumentService::Client) } | ||
let(:logger) { instance_double(Logger, info: nil) } | ||
|
||
describe "#put" do | ||
it "logs the put operation" do | ||
repository.put( | ||
"some_content_id", | ||
{ link: "/some/path" }, | ||
content: "Lorem ipsum dolor sit amet, consecutur edipiscing elit", | ||
payload_version: "1", | ||
) | ||
|
||
expect(logger).to have_received(:info).with( | ||
"[PUT some_content_id@v1] /some/path: " \ | ||
"'Lorem ipsum dolor sit amet, consecutur edipiscing e...'", | ||
) | ||
end | ||
end | ||
|
||
describe "#delete" do | ||
it "logs the delete operation" do | ||
repository.delete("some_content_id", payload_version: "1") | ||
|
||
expect(logger).to have_received(:info).with("[DELETE some_content_id@v1]") | ||
end | ||
end | ||
end |