neo4jrb / activegraph

An active model wrapper for the Neo4j Graph Database for Ruby.
http://neo4jrb.io
MIT License
1.4k stars 276 forks source link

Fixed warnings of mentioning specific exceptions in rspec #1571

Closed mrhardikjoshi closed 4 years ago

mrhardikjoshi commented 4 years ago

Fixes 3 warning related to mentioning specific exception class while running test cases

This pull introduces/changes:

1. neo4j/spec/e2e/association_proxy_spec.rb:406

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 neo4j/spec/e2e/association_proxy_spec.rb:406:in `block (3 levels) in <top (required)>'.

2. neo4j/spec/e2e/association_proxy_spec.rb:187

WARNING: Using the raise_error matcher without providing a specific error or message risks false positives, since raise_error will match when Ruby raises a NoMethodError, NameError or ArgumentError, potentially allowing the expectation to pass without even executing the method you are intending to call. Actual error raised was #<RuntimeError: Cannot eager load "past" a polymorphic association. (Since the association can return multiple models, we don't how to handle the "lessons" association.)>. Instead consider providing a specific error class or message. This message can be suppressed by setting: RSpec::Expectations.configuration.on_potential_false_positives = :nothing. Called from neo4j/spec/e2e/association_proxy_spec.rb:187:in `block (3 levels) in <top (required)>'.

3. neo4j/spec/e2e/undeclared_properties_spec.rb:35

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 neo4j/spec/e2e/undeclared_properties_spec.rb:35:in `block (3 levels) in <top (required)>'.

codecov-io commented 4 years ago

Codecov Report

Merging #1571 into master will not change coverage. The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #1571   +/-   ##
=======================================
  Coverage   93.23%   93.23%           
=======================================
  Files         105      105           
  Lines        4774     4774           
=======================================
  Hits         4451     4451           
  Misses        323      323

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 6da5e9c...fe06dc4. Read the comment docs.