Sha256: 7ad836149f80e8a2f37d99ac77d7144ac825da5f6be025d02a82ef8d352287be
Contents?: true
Size: 932 Bytes
Versions: 4
Compression:
Stored size: 932 Bytes
Contents
require 'helper' class TestParanoia < Test::Unit::TestCase context "working with versions" do setup do User.delete_all User.deleted.delete_all @user = User.create(:login => "foo", :email => "foo@bar.baz") end should "not delete permanently the record" do @user.destroy User.deleted.count.should == 1 User.count.should == 0 end should "restore the deleted record" do @user.destroy User.deleted.first.restore.email.should == "foo@bar.baz" end should "delete the old records" do @user.destroy deleted = User.deleted.first deleted.created_at = 2.months.ago deleted.save User.deleted.compact! User.deleted.count.should == 0 end should "find the record using the original id" do id = @user.id @user.destroy User.deleted.find(id).should_not be_nil end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
mongoid_ext-0.9.0 | test/test_paranoia.rb |
mongoid_ext-0.7.1 | test/test_paranoia.rb |
mongoid_ext-0.6.2 | test/test_paranoia.rb |
mongoid_ext-0.6.1 | test/test_paranoia.rb |