Created
September 13, 2016 14:56
-
-
Save yawboakye/0d3b8e08268e26159ed5208af439990d to your computer and use it in GitHub Desktop.
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
# fixture | |
one: | |
type: TextTimelineItem | |
item_text: Hello, hello, happiness | |
# controller test | |
test "should create comment for a commentable" do | |
t = text_timeline_items(:one) | |
# t.id changes for every test :( | |
post comments_url, | |
params: { content: "Congratulations", "commentable_type": "TextTimelineItem", "commentable_id": t.id }, | |
as: :json | |
assert_response :created | |
end | |
# schema.rb | |
create_table "comments", id: :uuid, default: -> { "gen_random_uuid()" } do | |
t.uuid commentable_id | |
t.text commentable_type | |
t.text content | |
... | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment