adds specs

This commit is contained in:
MaiteHdezRivas
2016-01-14 13:12:34 +01:00
parent b2686cc6d1
commit b3ee6d4921
2 changed files with 26 additions and 0 deletions

View File

@@ -675,6 +675,20 @@ describe Debate do
end
describe "#last_week" do
it "should return debates created this week" do
debate = create(:debate)
expect(Debate.last_week.all).to include (debate)
end
it "should not show debates created more than a week ago" do
debate = create(:debate, created_at: 8.days.ago)
expect(Debate.last_week.all).to_not include (debate)
end
end
end
end

View File

@@ -613,6 +613,18 @@ describe Proposal do
end
describe "#last_week" do
it "should return proposal created this week" do
proposal = create(:proposal)
expect(Proposal.last_week.all).to include (proposal)
end
it "should not show proposals created more than a week ago" do
proposal = create(:proposal, created_at: 8.days.ago)
expect(Proposal.last_week.all).to_not include (proposal)
end
end
end
end