-
Notifications
You must be signed in to change notification settings - Fork 193
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move
stub_request_for_schema
to a helper
We were getting flaky tests when using `stub_request_for_schema` in two places because the helper function was defined in two files, but the implementation was slightly different. This unifies the behaviour, returning the stub schema in both places, whilst also moving the helper code to a module, which we include when we need it.
- Loading branch information
Showing
4 changed files
with
10 additions
and
11 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
7 changes: 7 additions & 0 deletions
7
lib/engines/content_object_store/test/support/integration_test_helpers.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,7 @@ | ||
module ContentObjectStore::IntegrationTestHelpers | ||
def stub_request_for_schema(block_type) | ||
schema = stub(id: "content_block_type", fields: %w[foo bar], name: "schema", body: {}, block_type:) | ||
ContentObjectStore::ContentBlock::Schema.stubs(:find_by_block_type).with(block_type).returns(schema) | ||
schema | ||
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