require "rails_helper"

RSpec.describe Event, type: :model do
  it { should validate_presence_of(:name) }
  it { should validate_presence_of(:date) }

  describe ".upcoming" do
    it "returns only future events" do
      future = create(:event, date: 1.week.from_now)
      create(:event, date: 1.week.ago)

      expect(Event.upcoming).to eq([future])
    end
  end
end
