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

@@ -136,11 +136,23 @@ class ArtistsControllerTest < ActionController::TestCase
end
end
should "revert an artist" do
@artist.update_attributes(:name => "xyz")
@artist.update_attributes(:name => "abc")
version = @artist.versions.first
post :revert, {:id => @artist.id, :version_id => version.id}
context "reverting an artist" do
should "work" do
@artist.update_attributes(:name => "xyz")
@artist.update_attributes(:name => "abc")
version = @artist.versions.first
post :revert, {:id => @artist.id, :version_id => version.id}
end
should "not allow reverting to a previous version of another artist" do
@artist2 = FactoryGirl.create(:artist)
post :revert, { :id => @artist.id, :version_id => @artist2.versions(true).first.id }, {:user_id => @user.id}
@artist.reload
assert_not_equal(@artist.name, @artist2.name)
assert_response :missing
end
end
context "when finding an artist" do