docbrown/spec/models/event_spec.rb
rhymes 1b60ee5009 Use timezone aware methods (#893)
* Use timezone aware datetime methods

* Use timezone aware date parse for GitHub issue tag

* Introduce a bit of chaos programming using Zonebie

Zonebie uses a random timezone to run tests, it's a really good way to see if the code is timezone dependent or not.

* Convert GitHub issue date as UTC
2018-10-18 16:26:29 -04:00

25 lines
590 B
Ruby

require "rails_helper"
RSpec.describe Event, type: :model do
let(:event) { create(:event) }
it "rejects title with over 90 characters" do
event.title = Faker::Lorem.characters(100)
expect(event).not_to be_valid
end
it "rejects invalid http url" do
event.location_url = "dev.to"
expect(event).not_to be_valid
end
it "rejects ends times that are earlier than start times" do
event.ends_at = 14.hours.ago
expect(event).not_to be_valid
end
it "creates slug for published events" do
event.published = true
expect(event).to be_valid
end
end