Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 3 additions & 6 deletions spec/dashboard_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,11 @@
describe Dashboard do
describe "#posts" do
it "returns posts created today" do
create :post, title: "first_today", created_at: Time.now.beginning_of_day
create :post, title: "last_today", created_at: Time.now.end_of_day
create :post, title: "yesterday", created_at: 1.day.ago.end_of_day
posts_published_today = double("published_today")
expect(Post).to receive(:today).and_return(posts_published_today)
dashboard = Dashboard.new(posts: Post.all)

result = dashboard.posts

expect(result.map(&:title)).to match_array(%w(first_today last_today))
expect(dashboard.posts).to eq posts_published_today
end
end

Expand Down