diff --git a/test/controllers/forum_post_votes_controller_test.rb b/test/controllers/forum_post_votes_controller_test.rb deleted file mode 100644 index c5c1ce8d1..000000000 --- a/test/controllers/forum_post_votes_controller_test.rb +++ /dev/null @@ -1,36 +0,0 @@ -require 'test_helper' - -class ForumPostVotesControllerTest < ActionDispatch::IntegrationTest - context "The forum post votes controller" do - setup do - @user = create(:user) - - as_user do - @forum_topic = create(:forum_topic) - @forum_post = create(:forum_post, topic: @forum_topic) - end - end - - should "allow voting" do - assert_difference("ForumPostVote.count") do - post_auth forum_post_votes_path(forum_post_id: @forum_post.id), @user, params: {forum_post_vote: {score: 1}, format: "js"} - end - assert_response :success - end - - context "when deleting" do - setup do - as_user do - @forum_post_vote = @forum_post.votes.create(score: 1) - end - end - - should "allow removal" do - assert_difference("ForumPostVote.count", -1) do - delete_auth forum_post_votes_path(forum_post_id: @forum_post.id), @user, params: {format: "js"} - end - assert_response :success - end - end - end -end diff --git a/test/functional/artists_controller_test.rb b/test/functional/artists_controller_test.rb index 284bef9de..83ae04457 100644 --- a/test/functional/artists_controller_test.rb +++ b/test/functional/artists_controller_test.rb @@ -149,20 +149,13 @@ class ArtistsControllerTest < ActionDispatch::IntegrationTest assert_redirected_to(artist_path(@artist.id)) end - should "not touch the updater_id and updated_at fields when nothing is changed" do + should "not touch the updated_at fields when nothing is changed" do old_timestamp = @wiki_page.updated_at - old_updater_id = @wiki_page.updater_id - travel(1.minute) do - as(@another_user) do - @artist.update(notes: "testing") - end - end + travel(1.minute) + as(@another_user) { @artist.update(notes: "testing") } - @artist.reload - @wiki_page = @artist.wiki_page - assert_equal(old_timestamp.to_i, @wiki_page.updated_at.to_i) - assert_equal(old_updater_id, @wiki_page.updater_id) + assert_equal(old_timestamp.to_i, @artist.reload.wiki_page.updated_at.to_i) end context "when renaming an artist" do diff --git a/test/functional/forum_post_votes_controller_test.rb b/test/functional/forum_post_votes_controller_test.rb index 635345faa..3c6cf9766 100644 --- a/test/functional/forum_post_votes_controller_test.rb +++ b/test/functional/forum_post_votes_controller_test.rb @@ -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 diff --git a/test/functional/wiki_pages_controller_test.rb b/test/functional/wiki_pages_controller_test.rb index 08cf5578e..c93698590 100644 --- a/test/functional/wiki_pages_controller_test.rb +++ b/test/functional/wiki_pages_controller_test.rb @@ -154,24 +154,16 @@ class WikiPagesControllerTest < ActionDispatch::IntegrationTest @wiki_page.reload assert_equal(true, @wiki_page.is_deleted?) end - - should "record the deleter" do - delete_auth wiki_page_path(@wiki_page), @mod - @wiki_page.reload - assert_equal(@mod.id, @wiki_page.updater_id) - end end context "revert action" do setup do as_user do - @wiki_page = create(:wiki_page, :body => "1") - end - travel(1.day) do - @wiki_page.update(:body => "1 2") - end - travel(2.days) do - @wiki_page.update(:body => "1 2 3") + @wiki_page = create(:wiki_page, body: "1") + travel(1.day) + @wiki_page.update(body: "1 2") + travel(2.days) + @wiki_page.update(body: "1 2 3") end end diff --git a/test/unit/wiki_page_test.rb b/test/unit/wiki_page_test.rb index 3bee43934..96b07ddb5 100644 --- a/test/unit/wiki_page_test.rb +++ b/test/unit/wiki_page_test.rb @@ -101,16 +101,6 @@ class WikiPageTest < ActiveSupport::TestCase assert_equal("hot_potato", @wiki_page.title) end - should "differentiate between updater and creator" do - another_user = FactoryBot.create(:user) - CurrentUser.scoped(another_user, "127.0.0.1") do - @wiki_page.title = "yyy" - @wiki_page.save - end - version = WikiPageVersion.last - assert_not_equal(@wiki_page.creator_id, version.updater_id) - end - should "update its dtext links" do @wiki_page.update!(body: "[[long hair]]") assert_equal(1, @wiki_page.dtext_links.size)