You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
-60Lines changed: 0 additions & 60 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -69,26 +69,6 @@ rubocop-rspec is available on Code Climate as part of the rubocop engine. [Learn
69
69
70
70
You can read more about RuboCop-RSpec in its [official manual](https://docs.rubocop.org/rubocop-rspec).
71
71
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
-
92
72
## The Cops
93
73
94
74
All cops are located under
@@ -104,46 +84,6 @@ RSpec/FilePath:
104
84
- spec/my_poorly_named_spec_file.rb
105
85
```
106
86
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
-
147
87
## Contributing
148
88
149
89
Checkout the [contribution guidelines](.github/CONTRIBUTING.md).
RSpec-specific analysis for your projects, as an extension to
2
4
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.
Copy file name to clipboardExpand all lines: docs/modules/ROOT/pages/usage.adoc
+24-1Lines changed: 24 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -18,7 +18,7 @@ cops together with the standard cops.
18
18
19
19
[source,bash]
20
20
----
21
-
rubocop --require rubocop-rspec
21
+
$ rubocop --require rubocop-rspec
22
22
----
23
23
24
24
== Rake task
@@ -33,3 +33,26 @@ end
33
33
== Code Climate
34
34
35
35
`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:
0 commit comments