Skip to content

Instantly share code, notes, and snippets.

@Lackoftactics
Created May 21, 2013 08:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Lackoftactics/5618394 to your computer and use it in GitHub Desktop.
Save Lackoftactics/5618394 to your computer and use it in GitHub Desktop.
context "Validates presence of either start time or open time" do
setup do
@user = FactoryGirl.create(:user)
@account = FactoryGirl.create(:account, user: @user)
@location = FactoryGirl.create(:location, account: @account)
end
should "not be valid without open time or start time " do
event = FactoryGirl.build(:event, fb_id: '12345', account: @account, location: @location, start_at: nil, open_at: nil, end_at: Time.now + 1.hour)
assert !event.valid?
end
should "be valid with open_at" do
event = FactoryGirl.build(:event, fb_id: '12345', account: @account, location: @location, start_at: nil, end_at: Time.now + 1.hour)
assert event.valid?
end
should "be valid with start_at " do
event = FactoryGirl.build(:event, fb_id: '12345', account: @account, location: @location, open_at: nil, end_at: Time.now + 1.hour)
assert event.valid?
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment