test/paranoia_test.rb in paranoia-1.2.0 vs test/paranoia_test.rb in paranoia-1.3.0
- old
+ new
@@ -52,11 +52,10 @@
model.save!
assert_equal 1, model.class.count
model.destroy
assert_equal true, model.deleted_at.nil?
- assert model.frozen?
assert_equal 0, model.class.count
assert_equal 0, model.class.unscoped.count
end
@@ -66,11 +65,10 @@
model.save!
assert_equal 1, model.class.count
model.destroy
assert_equal false, model.deleted_at.nil?
- assert model.frozen?
assert_equal 0, model.class.count
assert_equal 1, model.class.unscoped.count
end
@@ -103,11 +101,12 @@
end
# Regression test for #24
def test_chaining_for_paranoid_models
scope = FeaturefulModel.where(:name => "foo").only_deleted
- assert_equal "foo", scope.where_values_hash[:name]
+
+ assert_equal "foo", scope.where_values_hash["name"]
assert_equal 2, scope.where_values.count
end
def test_only_destroyed_scope_for_paranoid_models
model = ParanoidModel.new
@@ -183,27 +182,28 @@
assert model.destroyed?
model = ParanoidModel.only_deleted.find(id)
model.restore!
+ model.reload
assert_equal false, model.destroyed?
end
def test_real_destroy
model = ParanoidModel.new
model.save
model.destroy!
- assert_equal false, ParanoidModel.unscoped.exists?(model.id)
+ assert_equal false, !!ParanoidModel.unscoped.exists?(model.id)
end
def test_real_delete
model = ParanoidModel.new
model.save
model.delete!
- assert_equal false, ParanoidModel.unscoped.exists?(model.id)
+ assert_equal false, !!ParanoidModel.unscoped.exists?(model.id)
end
private
def get_featureful_model
FeaturefulModel.new(:name => "not empty")