tests: fix forum post votes & wiki page updater tests.
* Move forum post vote tests from test/controllers to test/functional. * Fix forum post vote tests to work with new routes. * Fix obsolete wiki page tests dealing with updater_id.
This commit is contained in:
@@ -8,13 +8,32 @@ class ForumPostVotesControllerTest < ActionDispatch::IntegrationTest
|
||||
as(@user) do
|
||||
@forum_topic = create(:forum_topic)
|
||||
@forum_post = create(:forum_post, topic: @forum_topic)
|
||||
@forum_post_vote = create(:forum_post_vote, creator: @user, forum_post: @forum_post)
|
||||
end
|
||||
end
|
||||
|
||||
context "index action" do
|
||||
should "render" do
|
||||
@forum_post_vote = create(:forum_post_vote, creator: @user, forum_post: @forum_post)
|
||||
get forum_post_votes_path
|
||||
|
||||
assert_response :success
|
||||
end
|
||||
end
|
||||
|
||||
should "allow voting" do
|
||||
assert_difference("ForumPostVote.count") do
|
||||
post_auth forum_post_votes_path(format: :js), @user, params: { forum_post_id: @forum_post.id, forum_post_vote: { score: 1 }}
|
||||
end
|
||||
assert_response :success
|
||||
end
|
||||
|
||||
context "when deleting" do
|
||||
should "allow removal" do
|
||||
@forum_post_vote = create(:forum_post_vote, creator: @user, forum_post: @forum_post)
|
||||
assert_difference("ForumPostVote.count", -1) do
|
||||
delete_auth forum_post_vote_path(@forum_post_vote.id, format: :js), @user
|
||||
end
|
||||
|
||||
assert_response :success
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user