Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failing test case: calling reload doesn't update #destroyed? #75

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
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