docbrown/spec/models/event_spec.rb
rhymes e588fa7ece Code cleanups (#659)
* Initial automatic cleanup with rubocop

* Fix syntax error introduced by rubocop

* Cleanup seeds file

* Cleanup lib folder

* Exclude bin folder because it contains auto generated files

* Make Rubocop a little bit more chatty

* Block length should not include comments in the count

* Cleanup config folder

* Cleanup specs

* Updated Rubocop version and generated a todo file

* Fix broken ArticlesApi spec

* Fix tests

* Restored rubocop pre-commit hook
2018-08-07 11:00:13 -04:00

25 lines
594 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 = Time.now - 50000
expect(event).not_to be_valid
end
it "creates slug for published events" do
event.published = true
expect(event).to be_valid
end
end