Skip to content

Commit b15eefb

Browse files
committed
Move some text from the README to the docs
1 parent a8d756a commit b15eefb

File tree

3 files changed

+75
-61
lines changed

3 files changed

+75
-61
lines changed

README.md

Lines changed: 0 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -69,26 +69,6 @@ rubocop-rspec is available on Code Climate as part of the rubocop engine. [Learn
6969

7070
You can read more about RuboCop-RSpec in its [official manual](https://docs.rubocop.org/rubocop-rspec).
7171

72-
## Inspecting files that don't end with `_spec.rb`
73-
74-
By default, `rubocop-rspec` only inspects code within paths ending in `_spec.rb` or including `spec/`. You can override this setting in your config file by specifying one or more patterns:
75-
76-
```yaml
77-
# Inspect all files
78-
AllCops:
79-
RSpec:
80-
Patterns:
81-
- '.+'
82-
```
83-
84-
```yaml
85-
# Inspect only files ending with `_test.rb`
86-
AllCops:
87-
RSpec:
88-
Patterns:
89-
- '_test.rb$'
90-
```
91-
9272
## The Cops
9373

9474
All cops are located under
@@ -104,46 +84,6 @@ RSpec/FilePath:
10484
- spec/my_poorly_named_spec_file.rb
10585
```
10686

107-
## Non-goals of RuboCop RSpec
108-
109-
### Enforcing `should` vs. `expect` syntax
110-
111-
Enforcing
112-
113-
```ruby
114-
expect(calculator.compute(line_item)).to eq(5)
115-
```
116-
117-
over
118-
119-
```ruby
120-
calculator.compute(line_item).should == 5
121-
```
122-
123-
is a feature of RSpec itself – you can read about it in the [RSpec Documentation](https://relishapp.com/rspec/rspec-expectations/docs/syntax-configuration#disable-should-syntax)
124-
125-
### Enforcing an explicit RSpec receiver for top-level methods (disabling monkey patching)
126-
127-
Enforcing
128-
129-
```ruby
130-
RSpec.describe MyClass do
131-
...
132-
end
133-
```
134-
135-
over
136-
137-
```ruby
138-
describe MyClass do
139-
...
140-
end
141-
```
142-
143-
can be achieved using RSpec's `disable_monkey_patching!` method, which you can read more about in the [RSpec Documentation](https://relishapp.com/rspec/rspec-core/v/3-7/docs/configuration/zero-monkey-patching-mode#monkey-patched-methods-are-undefined-with-%60disable-monkey-patching!%60). This will also prevent `should` from being defined on every object in your system.
144-
145-
Before disabling `should` you will need all your specs to use the `expect` syntax. You can use [Transpec](http://yujinakayama.me/transpec/), which will do the conversion for you.
146-
14787
## Contributing
14888

14989
Checkout the [contribution guidelines](.github/CONTRIBUTING.md).

docs/modules/ROOT/pages/index.adoc

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,53 @@
1+
= RuboCop RSpec
2+
13
RSpec-specific analysis for your projects, as an extension to
24
https://github.com/rubocop-hq/rubocop[RuboCop].
5+
6+
== Project Goals
7+
8+
* Enforce the guidelines and best practices outlined in the community https://rspec.rubystyle.guide[RSpec style guide]
9+
* Simplify the process of adopting new RSpec functionality
10+
11+
== Non-goals of RuboCop RSpec
12+
13+
=== Enforcing `should` vs. `expect` syntax
14+
15+
Enforcing
16+
17+
[source,bash]
18+
----
19+
expect(calculator.compute(line_item)).to eq(5)
20+
----
21+
22+
over
23+
24+
[source,bash]
25+
----
26+
calculator.compute(line_item).should == 5
27+
----
28+
29+
is a feature of RSpec itself – you can read about it in the https://relishapp.com/rspec/rspec-expectations/docs/syntax-configuration#disable-should-syntax[RSpec Documentation].
30+
31+
=== Enforcing an explicit RSpec receiver for top-level methods (disabling monkey patching)
32+
33+
Enforcing
34+
35+
[source,bash]
36+
----
37+
RSpec.describe MyClass do
38+
...
39+
end
40+
----
41+
42+
over
43+
44+
[source,bash]
45+
----
46+
describe MyClass do
47+
...
48+
end
49+
----
50+
51+
can be achieved using RSpec's `disable_monkey_patching!` method, which you can read more about in the https://relishapp.com/rspec/rspec-core/v/3-7/docs/configuration/zero-monkey-patching-mode#monkey-patched-methods-are-undefined-with-%60disable-monkey-patching!%60[RSpec Documentation]. This will also prevent `should` from being defined on every object in your system.
52+
53+
Before disabling `should` you will need all your specs to use the `expect` syntax. You can use http://yujinakayama.me/transpec/[Transpec], which will do the conversion for you.

docs/modules/ROOT/pages/usage.adoc

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ cops together with the standard cops.
1818

1919
[source,bash]
2020
----
21-
rubocop --require rubocop-rspec
21+
$ rubocop --require rubocop-rspec
2222
----
2323

2424
== Rake task
@@ -33,3 +33,26 @@ end
3333
== Code Climate
3434

3535
`rubocop-rspec` is available on Code Climate as part of the rubocop engine. https://codeclimate.com/changelog/55a433bbe30ba00852000fac[Learn More].
36+
37+
== Inspecting files that don't end with `_spec.rb`
38+
39+
By default, `rubocop-rspec` only inspects code within paths ending in `_spec.rb` or including `spec/`. You can override this setting in your config file by specifying one or more patterns:
40+
41+
[source,yaml]
42+
----
43+
# Inspect all files
44+
AllCops:
45+
RSpec:
46+
Patterns:
47+
- '.+'
48+
----
49+
50+
51+
[source,yaml]
52+
----
53+
# Inspect only files ending with `_test.rb`
54+
AllCops:
55+
RSpec:
56+
Patterns:
57+
- '_test.rb$'
58+
----

0 commit comments

Comments
 (0)