Uses the new field, erased_at, for erased users

This commit is contained in:
kikito
2015-10-21 14:28:21 +02:00
parent 3d4e82f94f
commit 6c5d1faa90
14 changed files with 123 additions and 10 deletions

View File

@@ -304,4 +304,55 @@ describe Proposal do
end
end
describe "cache" do
let(:proposal) { create(:proposal) }
it "should expire cache when it has a new comment" do
expect { create(:comment, commentable: proposal) }
.to change { proposal.updated_at }
end
it "should expire cache when it has a new vote" do
expect { create(:vote, votable: proposal) }
.to change { proposal.updated_at }
end
it "should expire cache when it has a new flag" do
expect { create(:flag, flaggable: proposal) }
.to change { proposal.reload.updated_at }
end
it "should expire cache when it has a new tag" do
expect { proposal.update(tag_list: "new tag") }
.to change { proposal.updated_at }
end
it "should expire cache when hidden" do
expect { proposal.hide }
.to change { proposal.updated_at }
end
it "should expire cache when the author is hidden" do
expect { proposal.author.hide }
.to change { [proposal.reload.updated_at, proposal.author.updated_at] }
end
it "should expire cache when the author is erased" do
expect { proposal.author.erase }
.to change { [proposal.reload.updated_at, proposal.author.updated_at] }
end
it "should expire cache when its author changes" do
expect { proposal.author.update(username: "Eva") }
.to change { [proposal.reload.updated_at, proposal.author.updated_at] }
end
it "should expire cache when the author's organization get verified" do
create(:organization, user: proposal.author)
expect { proposal.author.organization.verify }
.to change { [proposal.reload.updated_at, proposal.author.updated_at] }
end
end
end