when merging post versions, delete old version rather than updating it

This commit is contained in:
r888888888
2016-06-29 14:47:32 -07:00
parent 14d73d0622
commit 917e42ed29
2 changed files with 19 additions and 12 deletions

View File

@@ -59,6 +59,20 @@ class PostVersionTest < ActiveSupport::TestCase
end
end
context "that should be merged" do
setup do
@parent = FactoryGirl.create(:post)
@post = FactoryGirl.create(:post, :tag_string => "aaa bbb ccc", :rating => "q", :source => "xyz")
end
should "delete the previous version" do
assert_equal(1, @post.versions.count)
@post.update_attributes(:tag_string => "bbb ccc xxx", :source => "")
@post.reload
assert_equal(1, @post.versions.count)
end
end
context "that has been updated" do
setup do
@parent = FactoryGirl.create(:post)