2019-08-01 10:26:49 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
require 'spec_helper'
|
|
|
|
|
2020-06-24 14:09:03 -04:00
|
|
|
RSpec.describe Ci::BuildNeed, model: true do
|
2019-08-01 10:26:49 -04:00
|
|
|
let(:build_need) { build(:ci_build_need) }
|
|
|
|
|
|
|
|
it { is_expected.to belong_to(:build) }
|
|
|
|
|
|
|
|
it { is_expected.to validate_presence_of(:build) }
|
|
|
|
it { is_expected.to validate_presence_of(:name) }
|
|
|
|
it { is_expected.to validate_length_of(:name).is_at_most(128) }
|
2019-11-27 10:06:45 -05:00
|
|
|
|
|
|
|
describe '.artifacts' do
|
|
|
|
let_it_be(:with_artifacts) { create(:ci_build_need, artifacts: true) }
|
|
|
|
let_it_be(:without_artifacts) { create(:ci_build_need, artifacts: false) }
|
|
|
|
|
|
|
|
it { expect(described_class.artifacts).to contain_exactly(with_artifacts) }
|
|
|
|
end
|
2019-08-01 10:26:49 -04:00
|
|
|
end
|