samnang
11/1/2012 - 5:09 PM

Yay! Mocks! by Corey Haines Talk challenge

Yay! Mocks! by Corey Haines Talk challenge

describe Coderetreat do
  describe ".todays" do
    it "only includes retreats for today" do
      todays_event = FactoryGirl.create(:coderetreat, scheduled_for: Date.today)
      FactoryGirl.create(:coderetreat, scheduled_for: Date.yesterday)
      FactoryGirl.create(:coderetreat, scheduled_for: Date.tomorrow)

      Coderetreat.todays.should =~ [todays_event]
    end
  end
end
describe Coderetreat do
  let(:valid_attributes) { {scheduled_for: Date.today, location: "Seattle", host: "8th Light"} }

  describe ".todays" do
    it "only includes retreats for today" do
      todays_event = Coderetreat.create(valid_attributes.merge(scheduled_for: Date.today))
      Coderetreat.create(valid_attributes.merge(scheduled_for: Date.yesterday))
      Coderetreat.create(valid_attributes.merge(scheduled_for: Date.tomorrow))

      Coderetreat.todays.should =~ [todays_event]
    end
  end
end