From 2b173d7b6c4d0d66c7109ff79d8f0e5bbaf31d52 Mon Sep 17 00:00:00 2001 From: Jason Axelson Date: Wed, 25 Jan 2017 16:43:06 -1000 Subject: [PATCH] Destroyed at reload failing test --- test/destroyed_at_test.rb | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/test/destroyed_at_test.rb b/test/destroyed_at_test.rb index 9a1a2d2..e7f1bec 100644 --- a/test/destroyed_at_test.rb +++ b/test/destroyed_at_test.rb @@ -27,6 +27,22 @@ post.destroyed?.must_equal false end + # Failing test + it 'sets #destroyed? after a reload' do + post.destroyed?.must_equal false + Post.where(id: post.id).destroy_all + post.reload.destroyed?.must_equal true + end + + # Passing test + it 'sets #destroyed? after a reload (passing)' do + post.destroyed?.must_equal false + Post.where(id: post.id).destroy_all + post_id = post.id + post = Post.unscope(where: :destroyed_at).find(post_id) + post.reload.destroyed?.must_equal true + end + it 'runs destroy callbacks' do post.destroy_callback_count.must_equal nil post.destroy