blob: bdfc10c7644d1dcfff054d12c35d5833f5d811ae (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
# frozen_string_literal: true
RSpec.describe Spandx::Terraform::Parsers::LockFile do
subject(:parser) { described_class.new }
describe '#match?' do
it { is_expected.to be_match(to_path('.terraform.lock.hcl')) }
it { is_expected.not_to be_match(to_path('main.hcl')) }
it { is_expected.not_to be_match(to_path('main.tf')) }
end
describe '#parse' do
def build(name, version, path)
Spandx::Core::Dependency.new(name:, version:, path:)
end
context 'when parsing a .terraform.lock.hcl file' do
subject { parser.parse(path) }
let(:path) { fixture_file('terraform/simple/.terraform.lock.hcl') }
specify do
expect(subject).to match_array([
build('registry.terraform.io/hashicorp/aws', '3.39.0', path)
])
end
end
end
end
|