diff options
author | Gabriel Nagy <gabriel.nagy@puppet.com> | 2021-09-30 19:31:15 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-09-30 19:31:15 +0300 |
commit | 8f8c5a5b8f2addd157d353740202539218f2be9c (patch) | |
tree | 5ff1f5bbd08e7d556439df0f18756f10aeb34bf3 /spec | |
parent | 0d92e9f24280df1082ec8dfa2baf8778b853e0ca (diff) | |
parent | 855f3bba8bb1c29ea1ec2dae471c90bec7786f01 (diff) | |
download | puppet-augeas_core-8f8c5a5b8f2addd157d353740202539218f2be9c.tar.gz puppet-augeas_core-8f8c5a5b8f2addd157d353740202539218f2be9c.tar.bz2 |
Merge pull request #41 from BobosilaVictor/MODULES-11197
(MODULES-11197) Update puppetlabs-augeas_core to latest pdk template
Diffstat (limited to 'spec')
-rw-r--r-- | spec/spec_helper.rb | 20 | ||||
-rw-r--r-- | spec/unit/provider/augeas/augeas_spec.rb | 10 | ||||
-rw-r--r-- | spec/unit/puppet_x/augeas/util/parser_spec.rb | 3 | ||||
-rw-r--r-- | spec/unit/type/augeas_spec.rb | 8 |
4 files changed, 30 insertions, 11 deletions
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 29615cd..9b1fa6f 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -1,3 +1,9 @@ +# frozen_string_literal: true + +RSpec.configure do |c| + c.mock_with :rspec +end + require 'puppetlabs_spec_helper/module_spec_helper' require 'rspec-puppet-facts' @@ -31,16 +37,28 @@ default_facts.each do |fact, value| end RSpec.configure do |c| - c.mock_with :rspec c.default_facts = default_facts c.before :each do # set to strictest setting for testing # by default Puppet runs at warning level Puppet.settings[:strict] = :warning + Puppet.settings[:strict_variables] = true end c.filter_run_excluding(bolt: true) unless ENV['GEM_BOLT'] c.after(:suite) do end + + # Filter backtrace noise + backtrace_exclusion_patterns = [ + %r{spec_helper}, + %r{gems}, + ] + + if c.respond_to?(:backtrace_exclusion_patterns) + c.backtrace_exclusion_patterns = backtrace_exclusion_patterns + elsif c.respond_to?(:backtrace_clean_patterns) + c.backtrace_clean_patterns = backtrace_exclusion_patterns + end end # Ensures that a module is defined diff --git a/spec/unit/provider/augeas/augeas_spec.rb b/spec/unit/provider/augeas/augeas_spec.rb index 71d7c60..4750e7e 100644 --- a/spec/unit/provider/augeas/augeas_spec.rb +++ b/spec/unit/provider/augeas/augeas_spec.rb @@ -475,19 +475,19 @@ describe Puppet::Type.type(:augeas).provider(:augeas) do end describe 'performing is_numeric checks (#22617)' do it 'returns false for nil' do - expect(provider.is_numeric?(nil)).to eq(false) + expect(provider.numeric?(nil)).to eq(false) end it 'returns true for Integers' do - expect(provider.is_numeric?(9)).to eq(true) + expect(provider.numeric?(9)).to eq(true) end it 'returns true for numbers in Strings' do - expect(provider.is_numeric?('9')).to eq(true) + expect(provider.numeric?('9')).to eq(true) end it 'returns false for non-number Strings' do - expect(provider.is_numeric?('x9')).to eq(false) + expect(provider.numeric?('x9')).to eq(false) end it 'returns false for other types' do - expect(provider.is_numeric?([true])).to eq(false) + expect(provider.numeric?([true])).to eq(false) end end diff --git a/spec/unit/puppet_x/augeas/util/parser_spec.rb b/spec/unit/puppet_x/augeas/util/parser_spec.rb index f8b5b2b..9769d76 100644 --- a/spec/unit/puppet_x/augeas/util/parser_spec.rb +++ b/spec/unit/puppet_x/augeas/util/parser_spec.rb @@ -92,7 +92,8 @@ describe PuppetX::Augeas::Util::Parser do end it 'allows multi-character unicode hexadecimal character escapes with \\u{...}' do - expect(parse_to_array('["\u{7}", "\u{20}", "\u{100}", "\u{2026}", "\u{1F464}", "\u{100000}", "\u{53 74 72 69 6E 67}"]')).to eq(["\a", ' ', "\u{100}", "\u{2026}", "\u{1F464}", "\u{100000}", 'String']) + expect(parse_to_array('["\u{7}", "\u{20}", "\u{100}", "\u{2026}", "\u{1F464}", "\u{100000}", "\u{53 74 72 69 6E 67}"]')).to eq(["\a", ' ', "\u{100}", "\u{2026}", "\u{1F464}", "\u{100000}", + 'String']) end end diff --git a/spec/unit/type/augeas_spec.rb b/spec/unit/type/augeas_spec.rb index ac3ffa1..f397d74 100644 --- a/spec/unit/type/augeas_spec.rb +++ b/spec/unit/type/augeas_spec.rb @@ -36,21 +36,21 @@ describe augeas do params = [:name, :context, :onlyif, :changes, :root, :load_path, :type_check, :show_diff] properties.each do |property| - it "should have a #{property} property" do + it "has a #{property} property" do expect(augeas.attrclass(property).ancestors).to be_include(Puppet::Property) end - it "should have documentation for its #{property} property" do + it "has documentation for its #{property} property" do expect(augeas.attrclass(property).doc).to be_instance_of(String) end end params.each do |param| - it "should have a #{param} parameter" do + it "has a #{param} parameter" do expect(augeas.attrclass(param).ancestors).to be_include(Puppet::Parameter) end - it "should have documentation for its #{param} parameter" do + it "has documentation for its #{param} parameter" do expect(augeas.attrclass(param).doc).to be_instance_of(String) end end |