-
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 #81 from alphagov/test-repo
Move `TestRepository` into `lib/`
- Loading branch information
Showing
4 changed files
with
28 additions
and
31 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
# A fake repository for end-to-end testing purposes | ||
class TestRepository | ||
attr_reader :documents | ||
|
||
def initialize(documents = {}) | ||
@documents = documents | ||
end | ||
|
||
def exists?(content_id) | ||
documents.key?(content_id) | ||
end | ||
|
||
def get(content_id) | ||
documents[content_id] | ||
end | ||
|
||
# rubocop:disable Lint/UnusedMethodArgument | ||
def put(content_id, metadata, content: nil, payload_version: nil) | ||
documents[content_id] = { metadata:, content: } | ||
end | ||
|
||
def delete(content_id, payload_version: nil) | ||
documents.delete(content_id) | ||
end | ||
# rubocop:enable Lint/UnusedMethodArgument | ||
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 was deleted.
Oops, something went wrong.