metricfu / metric_fu

A fist full of code metrics
http://metricfu.github.com/metric_fu
MIT License
624 stars 96 forks source link

Fix Warnings When Running Tests #288

Closed jkeam closed 7 years ago

jkeam commented 7 years ago

When running the tests you see something like this:

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:         Required method /Users/jonathankeam/dev/projects/metric_fu/lib/metric_fu/gene...escending
        from Generator.  See generator class documentation for more
        information.
>. 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 /Users/jonathankeam/dev/projects/metric_fu/spec/metric_fu/generator_spec.rb:52:in `block (3 levels) in <top (required)>'.
.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:         Required method /Users/jonathankeam/dev/projects/metric_fu/lib/metric_fu/gene...escending
        from Generator.  See generator class documentation for more
        information.
>. 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 /Users/jonathankeam/dev/projects/metric_fu/spec/metric_fu/generator_spec.rb:57:in `block (3 levels) in <top (required)>'.
.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:         Required method /Users/jonathankeam/dev/projects/metric_fu/lib/metric_fu/gene...escending
        from Generator.  See generator class documentation for more
        information.
>. 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 /Users/jonathankeam/dev/projects/metric_fu/spec/metric_fu/generator_spec.rb:47:in `block (3 levels) in <top (required)>'.

It's easy to fix though. Just have to follow what the warning says and basically just add the correct error expectation.

jkeam commented 7 years ago

Merged.

jkeam commented 7 years ago

Woops not merged yet.

jkeam commented 7 years ago

Merged and closing this.