summaryrefslogtreecommitdiff
path: root/spec/unit/resource_spec.rb
diff options
context:
space:
mode:
authorPete Higgins <pete@peterhiggins.org>2020-05-29 12:56:42 -0700
committerPete Higgins <pete@peterhiggins.org>2020-05-29 13:00:23 -0700
commit4eb0277dd70770590493163d63699af0ca809a31 (patch)
tree42c8bc3a51bb6c769f474d8ea9276e18f61b5520 /spec/unit/resource_spec.rb
parent176a42569ea4601789b0aea2e897c3c2c1a78cc4 (diff)
downloadchef-4eb0277dd70770590493163d63699af0ca809a31.tar.gz
Fix rspec warning about `not_to raise_error` with a specific exception.fix-rspec-warning
WARNING: Using `expect { }.not_to raise_error(SpecificErrorClass)` risks false positives, since literally any other error would cause the expectation to pass, including those raised by Ruby (e.g. NoMethodError, NameError and ArgumentError), meaning the code you are intending to test may not even get reached. Instead consider using `expect { }.not_to raise_error` or `expect { }.to raise_error(DifferentSpecificErrorClass)`. This message can be suppressed by setting: `RSpec::Expectations.configuration.on_potential_false_positives = :nothing`. Called from /Users/pete/work/chef/spec/unit/resource_spec.rb:381:in `block (4 levels) in <top (required)>'. Signed-off-by: Pete Higgins <pete@peterhiggins.org>
Diffstat (limited to 'spec/unit/resource_spec.rb')
-rw-r--r--spec/unit/resource_spec.rb2
1 files changed, 1 insertions, 1 deletions
diff --git a/spec/unit/resource_spec.rb b/spec/unit/resource_spec.rb
index 3808d99a06..fd32313c83 100644
--- a/spec/unit/resource_spec.rb
+++ b/spec/unit/resource_spec.rb
@@ -378,7 +378,7 @@ describe Chef::Resource do
it "does not propagate validation errors" do
resource_class = Class.new(Chef::Resource) { property :foo, String, required: true }
resource = resource_class.new("required_property_tests")
- expect { resource.to_text }.to_not raise_error Chef::Exceptions::ValidationFailed
+ expect { resource.to_text }.to_not raise_error
end
end
end