forked from radar/by_star
/
past.rb
56 lines (45 loc) · 1.16 KB
/
past.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
require 'spec_helper'
shared_examples_for 'past' do
describe '#past_week' do
context 'point-in-time' do
subject { Post.past_week }
its(:count){ should eq 3 }
end
context 'timespan' do
subject { Event.past_week }
its(:count){ should eq 7 }
end
context 'timespan strict' do
subject { Event.past_week(strict: true) }
its(:count){ should eq 0 }
end
end
describe '#past_fortnight' do
context 'point-in-time' do
subject { Post.past_fortnight }
its(:count){ should eq 4 }
end
context 'timespan' do
subject { Event.past_fortnight }
its(:count){ should eq 8 }
end
context 'timespan strict' do
subject { Event.past_fortnight(strict: true) }
its(:count){ should eq 1 }
end
end
describe '#past_month' do
context 'point-in-time' do
subject { Post.past_month }
its(:count){ should eq 8 }
end
context 'timespan' do
subject { Event.past_month }
its(:count){ should eq 12 }
end
context 'timespan strict' do
subject { Event.past_month(strict: true) }
its(:count){ should eq 4 }
end
end
end