Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions test/destroyed_at_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down