FIX: today visits not shown

This commit is contained in:
Erick Guan 2014-12-29 20:29:09 +08:00
parent b48f04e772
commit fe7f2c6979
2 changed files with 6 additions and 1 deletions
spec/models

View file

@ -15,6 +15,7 @@ describe Report do
let(:user) { Fabricate(:user) }
before do
user.user_visits.create(visited_at: 1.hour.ago)
user.user_visits.create(visited_at: 1.day.ago)
user.user_visits.create(visited_at: 2.days.ago)
end
@ -22,6 +23,10 @@ describe Report do
it "returns a report with data" do
report.data.should be_present
end
it "return today's visit" do
report.data.select { |v| v[:x].today? }.should be_present
end
end
end