-
Notifications
You must be signed in to change notification settings - Fork 194
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
We take the minimal fields needed to imitate a Document. We are taking the approach of duplication before reuse to help us move quickly and learn where the parts we would like to reuse are. Co-authored-by: Harriet H-W <[email protected]>
- Loading branch information
Showing
5 changed files
with
51 additions
and
1 deletion.
There are no files selected for viewing
11 changes: 11 additions & 0 deletions
11
db/migrate/20240627142613_create_content_block_documents.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,11 @@ | ||
class CreateContentBlockDocuments < ActiveRecord::Migration[7.1] | ||
def change | ||
create_table :content_block_documents do |t| | ||
t.string :content_id | ||
t.string :title | ||
t.string :block_type | ||
t.datetime "created_at", precision: nil | ||
t.datetime "updated_at", precision: nil | ||
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
2 changes: 2 additions & 0 deletions
2
lib/engines/content_object_store/app/models/content_object_store/content_block_document.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,2 @@ | ||
class ContentObjectStore::ContentBlockDocument < ApplicationRecord | ||
end |
9 changes: 9 additions & 0 deletions
9
lib/engines/content_object_store/test/factories/content_block_document.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,9 @@ | ||
FactoryBot.define do | ||
factory :content_block_document, class: "ContentObjectStore::ContentBlockDocument" do | ||
sequence(:content_id) { SecureRandom.uuid } | ||
title { "Title" } | ||
block_type { "Type" } | ||
created_at { Time.zone.now.utc } | ||
updated_at { Time.zone.now.utc } | ||
end | ||
end |
20 changes: 20 additions & 0 deletions
20
lib/engines/content_object_store/test/unit/app/models/content_block_document_test.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,20 @@ | ||
require "test_helper" | ||
|
||
class ContentObjectStore::ContentBlockDocumentTest < ActiveSupport::TestCase | ||
test "content_block_document exists with required data" do | ||
content_block_document = create( | ||
:content_block_document, | ||
content_id: "52084b2d-4a52-4e69-ba91-3052b07c7eb6", | ||
title: "Title", | ||
block_type: "Type", | ||
created_at: Time.zone.local(2000, 12, 31, 23, 59, 59).utc, | ||
updated_at: Time.zone.local(2000, 12, 31, 23, 59, 59).utc, | ||
) | ||
|
||
assert_equal "52084b2d-4a52-4e69-ba91-3052b07c7eb6", content_block_document.content_id | ||
assert_equal "Title", content_block_document.title | ||
assert_equal "Type", content_block_document.block_type | ||
assert_equal Time.zone.local(2000, 12, 31, 23, 59, 59).utc, content_block_document.created_at | ||
assert_equal Time.zone.local(2000, 12, 31, 23, 59, 59).utc, content_block_document.updated_at | ||
end | ||
end |