adds specs

This commit is contained in:
rgarcia
2015-09-05 22:02:02 +02:00
parent 0bca1c5b95
commit 9515ccc3a8
3 changed files with 81 additions and 0 deletions

View File

@@ -268,4 +268,34 @@ describe Debate do
end
end
describe "cache" do
let(:debate) { create(:debate) }
it "should expire cache when it has a new comment" do
expect { create(:comment, commentable: debate) }
.to change { debate.updated_at }
end
it "should expire cache when it has a new vote" do
expect { create(:vote, votable: debate) }
.to change { debate.updated_at }
end
it "should expire cache when it has a new tag" do
expect { debate.update(tag_list: "new tag") }
.to change { debate.updated_at }
end
it "should expire cache when its author changes" do
expect { debate.author.update(username: "Eva") }
.to change { debate.reload.updated_at }
end
it "should expire cache when the author's organization get verified" do
create(:organization, user: debate.author)
expect { debate.author.organization.verify }
.to change { debate.reload.updated_at}
end
end
end