Skip to content

Commit 5c36f3c

Browse files
committed
Merge pull request #1082 from rspec/update_readme
Add note about `infer_spec_type_from_file_location!`
1 parent 8ee31f3 commit 5c36f3c

File tree

1 file changed

+20
-1
lines changed

1 file changed

+20
-1
lines changed

README.md

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,26 @@ bundle binstubs rspec-core
6262
For detailed information on the RSpec 3.x upgrade process see the
6363
[RSpec Upgrade docs](https://relishapp.com/rspec/docs/upgrade).
6464

65-
There is another `rspec-rails` specific change to be aware of:
65+
There are two particular `rspec-rails` specific changes to be aware of:
66+
67+
> File-type inference disabled by default
68+
69+
Previously we automatically inferred spec type from a file location, this
70+
was a surprising behaviour for new users and undesirable for some veteran users
71+
so from RSpec 3 onwards this behaviour must be explicitly opted into with:
72+
73+
```Ruby
74+
RSpec.configure do |config|
75+
config.infer_spec_type_from_file_location!
76+
end
77+
```
78+
79+
This change was made to accomplish our general goals of acting with the principle
80+
of least surprise and removing magic from RSpec. See [the directory structure
81+
documentation](https://www.relishapp.com/rspec/rspec-rails/v/3-0/docs/directory-structure)
82+
for more details.
83+
84+
The other `rspec-rails` specific change is:
6685

6786
> The default helper files created in RSpec 3.x have changed
6887

0 commit comments

Comments
 (0)