Skip to content

Commit c817490

Browse files
committed
Improved documentation for RSpec/ExpectActual
This PR is improves documentation for `RSpec/ExpectActual`. For example, if you create a gem by `bundle gem hoge`, the following rspec code will be created. ```ruby it "does something useful" do expect(false).to eq(true) end ``` At first glance, it seems to be autocorrected, but when both expected and actual values are literal, no autocorrection is performed. We'll add this as an explanation for cop.
1 parent b6516ba commit c817490

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

docs/modules/ROOT/pages/cops_rspec.adoc

+2
Original file line numberDiff line numberDiff line change
@@ -1483,6 +1483,8 @@ end
14831483

14841484
Checks for `expect(...)` calls containing literal values.
14851485

1486+
Autocorrection is performed when the expected is not a literal.
1487+
14861488
=== Examples
14871489

14881490
[source,ruby]

lib/rubocop/cop/rspec/expect_actual.rb

+2
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ module Cop
55
module RSpec
66
# Checks for `expect(...)` calls containing literal values.
77
#
8+
# Autocorrection is performed when the expected is not a literal.
9+
#
810
# @example
911
# # bad
1012
# expect(5).to eq(price)

0 commit comments

Comments
 (0)