Add deleted_by to Trashable tables

This commit is contained in:
Robin Ward
2013-07-09 15:20:18 -04:00
parent 4c0fe3bc12
commit b7327942af
18 changed files with 62 additions and 38 deletions

View File

@ -215,7 +215,7 @@ describe Notification do
Notification.create!(read: false, user_id: p2.user_id, topic_id: p2.topic_id, post_number: p2.post_number, data: '[]',
notification_type: Notification.types[:liked])
p2.trash!
p2.trash!(p.user)
# we may want to make notification "trashable" but for now we nuke pm notifications from deleted topics/posts
Notification.ensure_consistency!

View File

@ -1296,16 +1296,17 @@ describe Topic do
describe 'trash!' do
context "its category's topic count" do
let(:moderator) { Fabricate(:moderator) }
let(:category) { Fabricate(:category) }
it "subtracts 1 if topic is being deleted" do
topic = Fabricate(:topic, category: category)
expect { topic.trash! }.to change { category.reload.topic_count }.by(-1)
expect { topic.trash!(moderator) }.to change { category.reload.topic_count }.by(-1)
end
it "doesn't subtract 1 if topic is already deleted" do
topic = Fabricate(:topic, category: category, deleted_at: 1.day.ago)
expect { topic.trash! }.to_not change { category.reload.topic_count }
expect { topic.trash!(moderator) }.to_not change { category.reload.topic_count }
end
end
end

View File

@ -62,7 +62,7 @@ describe UserAction do
other_stats.should == expecting
public_topic.trash!
public_topic.trash!(user)
stats_for_user.should == []
stream_count.should == 0