diff --git a/spec/models/debate_spec.rb b/spec/models/debate_spec.rb index a90423645..9f60e8cca 100644 --- a/spec/models/debate_spec.rb +++ b/spec/models/debate_spec.rb @@ -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 + \ No newline at end of file diff --git a/spec/models/proposal_spec.rb b/spec/models/proposal_spec.rb index db9c356d0..e6e5b2f6f 100644 --- a/spec/models/proposal_spec.rb +++ b/spec/models/proposal_spec.rb @@ -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