add revert action
This commit is contained in:
@@ -97,6 +97,43 @@ context "Frontend" do
|
||||
assert last_response.ok?
|
||||
end
|
||||
|
||||
test "reverts single commit" do
|
||||
page1 = @wiki.page('B')
|
||||
|
||||
post "/revert/B/7c45b5f16ff3bae2a0063191ef832701214d4df5"
|
||||
follow_redirect!
|
||||
assert last_response.ok?
|
||||
|
||||
@wiki.clear_cache
|
||||
page2 = @wiki.page('B')
|
||||
assert_not_equal page1.version.sha, page2.version.sha
|
||||
assert_equal "INITIAL", page2.raw_data.strip
|
||||
end
|
||||
|
||||
test "reverts multiple commits" do
|
||||
page1 = @wiki.page('A')
|
||||
|
||||
post "/revert/A/302a5491a9a5ba12c7652ac831a44961afa312d2/b26b791cb7917c4f37dd9cb4d1e0efb24ac4d26f"
|
||||
follow_redirect!
|
||||
assert last_response.ok?
|
||||
|
||||
@wiki.clear_cache
|
||||
page2 = @wiki.page('A')
|
||||
assert_not_equal page1.version.sha, page2.version.sha
|
||||
assert_equal "INITIAL", page2.raw_data.strip
|
||||
end
|
||||
|
||||
test "cannot revert conflicting commit" do
|
||||
page1 = @wiki.page('A')
|
||||
|
||||
post "/revert/A/302a5491a9a5ba12c7652ac831a44961afa312d2"
|
||||
assert last_response.ok?
|
||||
|
||||
@wiki.clear_cache
|
||||
page2 = @wiki.page('A')
|
||||
assert_equal page1.version.sha, page2.version.sha
|
||||
end
|
||||
|
||||
def app
|
||||
Precious::App
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user