Skip to content

Commit

Permalink
Removed Ruby warning "WARNING: Using `expect { }.not_to raise_error(S…
Browse files Browse the repository at this point in the history
…pecificErrorClass)` 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)`." by making test less specific.
  • Loading branch information
JohnEricson committed Oct 7, 2020
1 parent ab62f19 commit 20e7555
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion spec/unit/puppet/catalog_diff/comparer_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@

latin1_string = [246].pack('C*').force_encoding('UTF-8')
res1[0][:parameters][:content] = latin1_string
expect{compare_resources(res1, res2, show_resource_diff: true)}.not_to raise_error(ArgumentError)
expect{compare_resources(res1, res2, show_resource_diff: true)}.not_to raise_error
diffs = compare_resources(res1, res2, show_resource_diff: true)

ruby_default_replacement_string_for_invalid_characters = '�'
Expand Down

0 comments on commit 20e7555

Please sign in to comment.