debian-mirror-gitlab/spec/lib/gitlab/ci/interpolation/context_spec.rb

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

29 lines
655 B
Ruby
Raw Normal View History

2023-04-23 21:23:45 +05:30
# frozen_string_literal: true
require 'fast_spec_helper'
2023-05-27 22:25:52 +05:30
RSpec.describe Gitlab::Ci::Interpolation::Context, feature_category: :pipeline_composition do
2023-04-23 21:23:45 +05:30
subject { described_class.new(ctx) }
let(:ctx) do
{ inputs: { key: 'abc' } }
end
describe '#depth' do
it 'returns a max depth of the hash' do
expect(subject.depth).to eq 2
end
end
context 'when interpolation context is too complex' do
let(:ctx) do
{ inputs: { key: { aaa: { bbb: 'ccc' } } } }
end
it 'raises an exception' do
expect { described_class.new(ctx) }
.to raise_error(described_class::ContextTooComplexError)
end
end
end