debian-mirror-gitlab/spec/lib/gitlab/ci/interpolation/context_spec.rb
2023-05-27 22:25:52 +05:30

28 lines
655 B
Ruby

# frozen_string_literal: true
require 'fast_spec_helper'
RSpec.describe Gitlab::Ci::Interpolation::Context, feature_category: :pipeline_composition do
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