summaryrefslogtreecommitdiff
path: root/spec/models/ci/build_need_spec.rb
blob: d1186fa981d1c38966e7b42788ff94a90e2af67f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# frozen_string_literal: true

require 'spec_helper'

describe Ci::BuildNeed, model: true do
  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) }

  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
end