Add tests for reverting to foreign versions.

This commit is contained in:
evazion
2016-10-11 04:07:28 +00:00
parent 23ad02fa9c
commit 80895ef46e
7 changed files with 102 additions and 5 deletions

View File

@@ -127,6 +127,16 @@ class PostsControllerTest < ActionController::TestCase
@post.reload
assert_equal("aaaa", @post.tag_string)
end
should "not allow reverting to a previous version of another post" do
@post2 = FactoryGirl.create(:post, :uploader_id => @user.id, :tag_string => "herp")
post :revert, { :id => @post.id, :version_id => @post2.versions.first.id }, {:user_id => @user.id}
@post.reload
assert_not_equal(@post.tag_string, @post2.tag_string)
assert_response :missing
end
end
end
end