require 'rails_helper' module Logistics module Core RSpec.describe EslTransportTariff, type: :model do it 'has a valid factory' do expect(create(:esl_transport_tariff)).to be_valid end it 'is invalid with no route' do expect(build(:esl_transport_tariff, :route => nil)).not_to be_valid end it 'is invalid with no storage point' do expect(build(:esl_transport_tariff, :storage_point => nil)).not_to be_valid end it 'is invalid with duplicate route and storage point' do tt = create(:esl_transport_tariff) expect(build(:esl_transport_tariff, :route => tt.route, :storage_point => tt.storage_point)).not_to be_valid end end end end