Skip to content

Commit

Permalink
Add test for augeas.version fact
Browse files Browse the repository at this point in the history
  • Loading branch information
bastelfreak committed May 14, 2024
1 parent 8c406ad commit 9c0a4d9
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions spec/facts_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,14 @@
expect(content['facterversion']).to have_facter_version(facter_dir_path, filepath)
end

# when facts are generated with distro facter or rubygems facter the augeas bindings might be missing
# we need to ensure they exist
it 'contains the augeas.version fact' do
if Gem::Version.new(content['facterversion']) >= Gem::Version.new('3.11.0')

Check failure on line 86 in spec/facts_spec.rb

View workflow job for this annotation

GitHub Actions / rubocop

Style/IfUnlessModifier: Favor modifier `if` usage when having a single-line body. Another good alternative is the usage of control flow `&&`/`||`. (https://rubystyle.guide#if-as-a-modifier)
expect(content['augeas']['version']).to not_be_nil.and not_be_empty
end
end

it 'contains newer networking facts hash' do
if Gem::Version.new(content['facterversion']) >= Gem::Version.new('3.0.0')
expect(content['networking']['ip']).to not_be_nil.and not_be_empty
Expand Down

0 comments on commit 9c0a4d9

Please sign in to comment.