forum topics: don't record a topic visit for api requests.

This commit is contained in:
evazion
2017-05-13 13:50:20 -05:00
parent 78b08d8394
commit 71a19c28f1
3 changed files with 13 additions and 3 deletions

View File

@@ -56,6 +56,16 @@ class ForumTopicsControllerTest < ActionController::TestCase
get :show, {:id => @forum_topic.id}
assert_response :success
end
should "record a topic visit for html requests" do
get :show, {id: @forum_topic.id}, {user_id: @user.id}
assert_not_nil(@user.reload.last_forum_read_at)
end
should "not record a topic visit for non-html requests" do
get :show, {id: @forum_topic.id, format: :json}, {user_id: @user.id}
assert_nil(@user.reload.last_forum_read_at)
end
end
context "index action" do