clarion/spec/models/track_spec.rb

25 lines
719 B
Ruby
Raw Permalink Normal View History

2019-04-28 21:10:54 +03:00
require "rails_helper"
2019-04-28 21:10:54 +03:00
RSpec.describe Track, type: :model do
it "is invalid without a name" do
expect(build(:track, name: "")).to have_error_on :name
end
2019-04-28 21:10:54 +03:00
describe "color" do
it "must be present" do
expect(build(:track, color: "")).to have_error_on :color
end
2019-04-28 21:10:54 +03:00
it "must be a hex RGB triplet" do
expect(build(:track, color: "foobar")).to have_error_on :color
expect(build(:track, color: "000000")).to_not have_error_on :color
expect(build(:track, color: "#000000")).to_not have_error_on :color
end
end
2019-04-28 21:10:54 +03:00
it "belongs to a conference" do
conference = create :conference
expect(build(:track, conference_id: conference.id).conference).to eq conference
end
end