Skip to content

Commit

Permalink
(CONT-666) Update resource_index spec tests
Browse files Browse the repository at this point in the history
This commit introduces some new spec test for the resource_indexes
method.

We check that it does not pick up any defaults declarations and also
that it can properly parse resource declarations after the change.
  • Loading branch information
chelnak committed Feb 28, 2023
1 parent 570cf73 commit 812dff0
Showing 1 changed file with 36 additions and 0 deletions.
36 changes: 36 additions & 0 deletions spec/unit/puppet-lint/data_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,42 @@
}
end
end

context 'when given a defaults declaration' do
let(:manifest) { "Service { 'foo': }" }

it 'returns an empty array' do
expect(data.resource_indexes).to eq([])
end
end

context 'when given a set of resource declarations' do
let(:manifest) { <<-MANIFEST }
service {
'foo':
ensure => running,
}
service {
'bar':
ensure => running;
'foobar':
ensure => stopped;
}
service { ['first', 'second']:
ensure => running,
}
service { 'third':
ensure => running,
}
MANIFEST

it 'returns an array of resource indexes' do
expect(data.resource_indexes.length).to eq(5)
end
end
end

describe '.insert' do
Expand Down

0 comments on commit 812dff0

Please sign in to comment.