27 lines
759 B
Ruby
27 lines
759 B
Ruby
require 'spec_helper'
|
|
|
|
describe EventSession do
|
|
|
|
it "should be creatable" do
|
|
event = FactoryBot.create(:event)
|
|
event_session = FactoryBot.create(:event_session, event: event)
|
|
end
|
|
|
|
it "requires a parent event" do
|
|
event_session = FactoryBot.build(:event_session)
|
|
event_session.save.should be false
|
|
event_session.errors[:event].should == ["can't be blank"]
|
|
end
|
|
|
|
it "can't specify both band and user" do
|
|
user = FactoryBot.create(:user)
|
|
band = FactoryBot.create(:band)
|
|
event = FactoryBot.create(:event)
|
|
event_session = FactoryBot.build(:event_session, event: event, user: user, band:band)
|
|
event_session.save.should be false
|
|
event_session.errors[:user].should == ["specify band, or user. not both"]
|
|
end
|
|
|
|
end
|
|
|