2013-02-06 03:16:51 +08:00
|
|
|
Fabricator(:post) do
|
|
|
|
user
|
2017-07-28 09:20:09 +08:00
|
|
|
topic { |attrs| Fabricate(:topic, user: attrs[:user]) }
|
2013-02-26 00:42:20 +08:00
|
|
|
raw "Hello world"
|
2015-09-22 06:50:52 +08:00
|
|
|
post_type Post.types[:regular]
|
2013-02-06 03:16:51 +08:00
|
|
|
end
|
|
|
|
|
2014-04-12 04:07:39 +08:00
|
|
|
Fabricator(:post_with_long_raw_content, from: :post) do
|
|
|
|
raw 'This is a sample post with semi-long raw content. The raw content is also more than
|
|
|
|
two hundred characters to satisfy any test conditions that require content longer
|
|
|
|
than the typical test post raw content.'
|
|
|
|
end
|
|
|
|
|
2013-02-06 03:16:51 +08:00
|
|
|
Fabricator(:post_with_youtube, from: :post) do
|
2015-09-30 00:51:26 +08:00
|
|
|
raw 'http://www.youtube.com/watch?v=9bZkp7q19f0'
|
2013-04-10 15:52:38 +08:00
|
|
|
cooked '<p><a href="http://www.youtube.com/watch?v=9bZkp7q19f0" class="onebox" target="_blank">http://www.youtube.com/watch?v=9bZkp7q19f0</a></p>'
|
2013-02-06 03:16:51 +08:00
|
|
|
end
|
|
|
|
|
|
|
|
Fabricator(:old_post, from: :post) do
|
2017-07-28 09:20:09 +08:00
|
|
|
topic { |attrs| Fabricate(:topic, user: attrs[:user], created_at: (DateTime.now - 100)) }
|
2013-02-06 03:16:51 +08:00
|
|
|
created_at (DateTime.now - 100)
|
|
|
|
end
|
|
|
|
|
|
|
|
Fabricator(:moderator_post, from: :post) do
|
|
|
|
user
|
2017-07-28 09:20:09 +08:00
|
|
|
topic { |attrs| Fabricate(:topic, user: attrs[:user]) }
|
2013-03-19 04:03:46 +08:00
|
|
|
post_type Post.types[:moderator_action]
|
2013-02-26 00:42:20 +08:00
|
|
|
raw "Hello world"
|
2013-02-06 03:16:51 +08:00
|
|
|
end
|
|
|
|
|
|
|
|
Fabricator(:basic_reply, from: :post) do
|
|
|
|
user(:coding_horror)
|
|
|
|
reply_to_post_number 1
|
|
|
|
topic
|
|
|
|
raw 'this reply has no quotes'
|
|
|
|
end
|
|
|
|
|
|
|
|
Fabricator(:reply, from: :post) do
|
|
|
|
user(:coding_horror)
|
|
|
|
topic
|
|
|
|
raw '
|
|
|
|
[quote="Evil Trout, post:1"]hello[/quote]
|
|
|
|
Hmmm!
|
|
|
|
'
|
|
|
|
end
|
|
|
|
|
2015-08-05 18:57:31 +08:00
|
|
|
Fabricator(:post_with_plenty_of_images, from: :post) do
|
2018-08-16 19:45:30 +08:00
|
|
|
cooked <<~HTML
|
2018-08-14 18:23:32 +08:00
|
|
|
<aside class="quote"><img src="/uploads/default/original/1X/1234567890123456.jpg"></aside>
|
|
|
|
<div class="onebox-result"><img src="/uploads/default/original/1X/1234567890123456.jpg"></div>
|
|
|
|
<div class="onebox"><img src="/uploads/default/original/1X/1234567890123456.jpg"></div>
|
2018-08-16 19:45:30 +08:00
|
|
|
<p>With an emoji! <img src="//cdn.discourse.org/meta/images/emoji/twitter/smile.png?v=#{Emoji::EMOJI_VERSION}" title=":smile:" class="emoji" alt="smile" width="72" height="72"></p>
|
|
|
|
HTML
|
2013-07-08 07:39:08 +08:00
|
|
|
end
|
|
|
|
|
2013-07-22 06:37:23 +08:00
|
|
|
Fabricator(:post_with_uploaded_image, from: :post) do
|
2018-08-14 18:23:32 +08:00
|
|
|
raw '<img src="/uploads/default/original/2X/3456789012345678.png" width="1500" height="2000">'
|
2013-07-08 07:39:08 +08:00
|
|
|
end
|
|
|
|
|
2013-07-11 04:59:07 +08:00
|
|
|
Fabricator(:post_with_an_attachment, from: :post) do
|
2018-08-14 18:23:32 +08:00
|
|
|
raw '<a class="attachment" href="/uploads/default/origina/1X/66b3ed1503efc936.zip">archive.zip</a>'
|
2013-07-11 04:59:07 +08:00
|
|
|
end
|
|
|
|
|
2013-07-08 07:39:08 +08:00
|
|
|
Fabricator(:post_with_unsized_images, from: :post) do
|
2015-09-30 00:51:26 +08:00
|
|
|
raw '
|
2013-07-08 07:39:08 +08:00
|
|
|
<img src="http://foo.bar/image.png">
|
2018-08-14 18:23:32 +08:00
|
|
|
<img src="/uploads/default/original/1X/1234567890123456.jpg">
|
2013-07-08 07:39:08 +08:00
|
|
|
'
|
|
|
|
end
|
|
|
|
|
2013-11-26 01:36:13 +08:00
|
|
|
Fabricator(:post_with_image_urls, from: :post) do
|
2015-09-30 00:51:26 +08:00
|
|
|
raw '
|
2013-11-26 01:36:13 +08:00
|
|
|
<img src="http://foo.bar/image.png">
|
|
|
|
<img src="http://domain.com/picture.jpg" width="50" height="42">
|
|
|
|
'
|
2013-07-08 07:39:08 +08:00
|
|
|
end
|
|
|
|
|
|
|
|
Fabricator(:post_with_large_image, from: :post) do
|
2018-08-14 18:23:32 +08:00
|
|
|
raw '<img src="/uploads/default/original/1X/1234567890123456.jpg">'
|
2013-07-08 07:39:08 +08:00
|
|
|
end
|
|
|
|
|
2014-11-04 05:03:06 +08:00
|
|
|
Fabricator(:post_with_large_image_and_title, from: :post) do
|
2018-08-14 18:23:32 +08:00
|
|
|
raw '<img src="/uploads/default/original/1X/1234567890123456.jpg" title="WAT">'
|
2014-11-04 05:03:06 +08:00
|
|
|
end
|
|
|
|
|
2016-03-10 11:50:07 +08:00
|
|
|
Fabricator(:post_with_large_image_on_subfolder, from: :post) do
|
2018-08-14 18:23:32 +08:00
|
|
|
raw '<img src="/subfolder/uploads/default/original/1X/1234567890123456.jpg">'
|
2016-03-10 11:50:07 +08:00
|
|
|
end
|
|
|
|
|
2013-11-06 02:04:47 +08:00
|
|
|
Fabricator(:post_with_uploads, from: :post) do
|
2015-09-30 00:51:26 +08:00
|
|
|
raw '
|
2018-08-14 18:23:32 +08:00
|
|
|
<a href="/uploads/default/original/2X/2345678901234567.jpg">Link</a>
|
|
|
|
<img src="/uploads/default/original/1X/1234567890123456.jpg">
|
2013-11-06 02:04:47 +08:00
|
|
|
'
|
|
|
|
end
|
|
|
|
|
|
|
|
Fabricator(:post_with_uploads_and_links, from: :post) do
|
2015-09-30 00:51:26 +08:00
|
|
|
raw '
|
2018-08-14 18:23:32 +08:00
|
|
|
<a href="/uploads/default/original/2X/2345678901234567.jpg">Link</a>
|
|
|
|
<img src="/uploads/default/original/1X/1234567890123456.jpg">
|
2013-11-06 02:04:47 +08:00
|
|
|
<a href="http://www.google.com">Google</a>
|
|
|
|
<img src="http://foo.bar/image.png">
|
2016-01-07 04:54:01 +08:00
|
|
|
<a class="attachment" href="/uploads/default/original/1X/af2c2618032c679333bebf745e75f9088748d737.txt">text.txt</a> (20 Bytes)
|
2016-07-16 00:37:51 +08:00
|
|
|
:smile:
|
2013-11-06 02:04:47 +08:00
|
|
|
'
|
|
|
|
end
|
|
|
|
|
2013-02-06 03:16:51 +08:00
|
|
|
Fabricator(:post_with_external_links, from: :post) do
|
|
|
|
user
|
|
|
|
topic
|
|
|
|
raw "
|
|
|
|
Here's a link to twitter: http://twitter.com
|
|
|
|
And a link to google: http://google.com
|
2016-06-07 04:58:35 +08:00
|
|
|
And a secure link to google: https://google.com
|
2013-02-06 03:16:51 +08:00
|
|
|
And a markdown link: [forumwarz](http://forumwarz.com)
|
|
|
|
And a markdown link with a period after it [codinghorror](http://www.codinghorror.com/blog).
|
2016-08-24 00:08:37 +08:00
|
|
|
And one with a hash http://discourse.org#faq
|
2013-02-06 03:16:51 +08:00
|
|
|
"
|
|
|
|
end
|
2013-04-04 01:25:52 +08:00
|
|
|
|
|
|
|
Fabricator(:private_message_post, from: :post) do
|
|
|
|
user
|
|
|
|
topic do |attrs|
|
2017-07-28 09:20:09 +08:00
|
|
|
Fabricate(:private_message_topic,
|
2013-04-04 01:25:52 +08:00
|
|
|
user: attrs[:user],
|
|
|
|
created_at: attrs[:created_at],
|
2013-04-17 04:56:18 +08:00
|
|
|
subtype: TopicSubtype.user_to_user,
|
2013-04-04 01:25:52 +08:00
|
|
|
topic_allowed_users: [
|
2017-04-27 11:53:53 +08:00
|
|
|
Fabricate.build(:topic_allowed_user, user: attrs[:user]),
|
|
|
|
Fabricate.build(:topic_allowed_user, user: Fabricate(:user))
|
2013-04-04 01:25:52 +08:00
|
|
|
]
|
|
|
|
)
|
|
|
|
end
|
|
|
|
raw "Ssshh! This is our secret conversation!"
|
2013-04-10 15:52:38 +08:00
|
|
|
end
|
2017-11-10 23:10:25 +08:00
|
|
|
|
|
|
|
Fabricator(:post_via_email, from: :post) do
|
|
|
|
incoming_email
|
|
|
|
via_email true
|
|
|
|
|
|
|
|
after_create do |post|
|
|
|
|
incoming_email.topic = post.topic
|
|
|
|
incoming_email.post = post
|
|
|
|
incoming_email.user = post.user
|
|
|
|
end
|
|
|
|
end
|