1
0
Fork 0
mirror of https://github.com/teamcapybara/capybara.git synced 2022-11-09 12:08:07 -05:00
teamcapybara--capybara/lib/capybara/rspec
Koichi ITO 676a21e13a
Add uplelvel to deprecation warning of Capybara (#2379)
Follow https://github.com/teamcapybara/capybara/issues/2371.

This PR adds `uplelvel` to deprecation warning of Capybara.
The `uplevel` option has been introduced from Ruby 2.6.

> If the `uplevel` keyword argument is given, the string will be prepended
with information for the given caller frame in the same format used by
the `rb_warn` C function.

https://ruby-doc.org/core-2.6.0/Kernel.html#method-i-warn

On the other hand, Capybara supports Ruby 2.5.
Therefore, This PR adds `Capybara::Helpers.warn` internal method
for emulating `warn 'message', uplevel: 1` in Ruby 2.5 or lower.

This option will clarify where deprecation warnings should be fixed.

## Before

```console
DEPRECATED: Calling 'has_key?' on the drivers/servers container is
deprecated without replacement
```

## After

```console
/Users/koic/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/turnip-4.1.0/
lib/turnip/capybara.rb:10: warning:
DEPRECATED: Calling 'has_key?' on the drivers/servers container is
deprecated without replacement
```
2020-09-06 12:21:53 -07:00
..
matchers More Ruby keyword arguments changes support 2020-07-05 14:55:59 -07:00
features.rb Code cleanup and enable line length cop 2018-11-03 13:03:48 -07:00
matcher_proxies.rb Fix Ruby 2.7 warnings in RSpec matcher proxies 2020-02-19 19:14:52 -08:00
matchers.rb Add uplelvel to deprecation warning of Capybara (#2379) 2020-09-06 12:21:53 -07:00