mirror of
https://github.com/zhigang1992/tsemple.git
synced 2026-04-30 05:35:29 +08:00
Post like/unlike actions
This commit is contained in:
@@ -1,6 +1,18 @@
|
||||
require 'test_helper'
|
||||
|
||||
class PostsHelperTest < ActionView::TestCase
|
||||
test "should ouput post_likes data" do
|
||||
post1 = create(:post)
|
||||
post2 = create(:post)
|
||||
create(:post)
|
||||
user = create(:user)
|
||||
|
||||
post1.like_users.push user
|
||||
post2.like_users.push user
|
||||
|
||||
assert_equal [post1.id, post2.id].sort, like_post_ids(user, Post.all).sort
|
||||
end
|
||||
|
||||
test "should link mentions" do
|
||||
assert_equal %q|<p><a href="/~username">@username</a></p>|, link_post_content('<p>@username</p>')
|
||||
assert_equal %q|<a href="http://example.org/">@username</a>|, link_post_content(%q|<a href="http://example.org/">@username</a>|)
|
||||
|
||||
Reference in New Issue
Block a user