Fix #4178: add ability to mass undo tag edits.
Adds checkboxes to the /post_versions index allowing you to select and undo multiple versions at once.
This commit is contained in:
33
test/system/post_version_test.rb
Normal file
33
test/system/post_version_test.rb
Normal file
@@ -0,0 +1,33 @@
|
||||
require "application_system_test_case"
|
||||
|
||||
class PostVersionTest < ApplicationSystemTestCase
|
||||
context "Post versions" do
|
||||
setup do
|
||||
@user = create(:builder_user)
|
||||
|
||||
as @user do
|
||||
@post = create(:post, tag_string: "tagme")
|
||||
travel 2.hours
|
||||
@post.update!(tag_string: "touhou")
|
||||
travel 2.hours
|
||||
@post.update!(tag_string: "touhou bkub")
|
||||
travel 2.hours
|
||||
end
|
||||
|
||||
signin @user
|
||||
visit post_versions_path
|
||||
end
|
||||
|
||||
context "clicking the undo selected button" do
|
||||
should "undo all selected post versions" do
|
||||
check id: "post-version-select-all-checkbox"
|
||||
assert all("td .post-version-select-checkbox:not(:disabled)").all?(&:checked?)
|
||||
|
||||
click_link "subnav-undo-selected-link"
|
||||
assert_selector "#notice span.prose", text: "2/2 changes undone."
|
||||
|
||||
assert_equal("tagme", @post.reload.tag_string)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -6,4 +6,11 @@ module SystemTestHelper
|
||||
fill_in "Password confirmation", with: password
|
||||
click_button "Sign up"
|
||||
end
|
||||
|
||||
def signin(user)
|
||||
visit new_session_path
|
||||
fill_in "Name", with: user.name
|
||||
fill_in "Password", with: user.password
|
||||
click_button "Submit"
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user