| 1 |
Feature: `--warnings` option (run with warnings enabled) |
| 2 |
|
| 3 |
Use the `--warnings` option to run specs with warnings enabled. |
| 4 |
|
| 5 |
@unsupported-on-rbx |
| 6 |
Scenario: |
| 7 |
Given a file named "example_spec.rb" with: |
| 8 |
"""ruby |
| 9 |
RSpec.describe do |
| 10 |
it 'generates warning' do |
| 11 |
$undefined |
| 12 |
end |
| 13 |
end |
| 14 |
""" |
| 15 |
When I run `rspec --warnings example_spec.rb` |
| 16 |
Then the output should contain "warning" |
| 17 |
|
| 18 |
@ruby-2-7 |
| 19 |
Scenario: |
| 20 |
Given a file named "example_spec.rb" with: |
| 21 |
"""ruby |
| 22 |
def foo(**kwargs) |
| 23 |
kwargs |
| 24 |
end |
| 25 |
|
| 26 |
RSpec.describe do |
| 27 |
it "should warn about keyword arguments with 'rspec -w'" do |
| 28 |
expect(foo({a: 1})).to eq({a: 1}) |
| 29 |
end |
| 30 |
end |
| 31 |
""" |
| 32 |
When I run `rspec -w example_spec.rb` |
| 33 |
Then the output should contain "warning" |
| 34 |
|
| 35 |
@unsupported-on-rbx |
| 36 |
Scenario: |
| 37 |
Given a file named "example_spec.rb" with: |
| 38 |
"""ruby |
| 39 |
RSpec.describe do |
| 40 |
it 'generates warning' do |
| 41 |
$undefined |
| 42 |
end |
| 43 |
end |
| 44 |
""" |
| 45 |
When I run `rspec example_spec.rb` |
| 46 |
Then the output should not contain "warning" |