Skip to content

Commit 0d50317

Browse files
committed
Convert the docs to AsciiDoc and Antora
1 parent 382e8ac commit 0d50317

File tree

11 files changed

+4214
-1
lines changed

11 files changed

+4214
-1
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ rubocop-rspec is available on Code Climate as part of the rubocop engine. [Learn
6767

6868
## Documentation
6969

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

7272
## Inspecting files that don't end with `_spec.rb`
7373

docs/antora.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
name: rubocop-rspec
2+
title: RuboCop RSpec
3+
version: master
4+
nav:
5+
- modules/ROOT/nav.adoc

docs/modules/ROOT/nav.adoc

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
* xref:index.adoc[Home]
2+
* xref:installation.adoc[Installation]
3+
* xref:usage.adoc[Usage]
4+
* xref:cops.adoc[Cops]
5+
* Cops Documentation
6+
** xref:cops_capybara.adoc[Capybara]
7+
** xref:cops_factorybot.adoc[FactoryBot]
8+
** xref:cops_rails.adoc[Rails]
9+
** xref:cops_rspec.adoc[RSpec]

docs/modules/ROOT/pages/cops.adoc

Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
// START_COP_LIST
2+
3+
==== Department xref:cops_capybara.adoc[Capybara]
4+
5+
* link:cops_capybara.md#capybaracurrentpathexpectation[Capybara/CurrentPathExpectation]
6+
* link:cops_capybara.md#capybarafeaturemethods[Capybara/FeatureMethods]
7+
* link:cops_capybara.md#capybaravisibilitymatcher[Capybara/VisibilityMatcher]
8+
9+
==== Department xref:cops_factorybot.adoc[FactoryBot]
10+
11+
* link:cops_factorybot.md#factorybotattributedefinedstatically[FactoryBot/AttributeDefinedStatically]
12+
* link:cops_factorybot.md#factorybotcreatelist[FactoryBot/CreateList]
13+
* link:cops_factorybot.md#factorybotfactoryclassname[FactoryBot/FactoryClassName]
14+
15+
==== Department xref:cops_rspec.adoc[RSpec]
16+
17+
* link:cops_rspec.adoc#rspecalignleftletbrace[RSpec/AlignLeftLetBrace]
18+
* link:cops_rspec.adoc#rspecalignrightletbrace[RSpec/AlignRightLetBrace]
19+
* link:cops_rspec.adoc#rspecanyinstance[RSpec/AnyInstance]
20+
* link:cops_rspec.adoc#rspecaroundblock[RSpec/AroundBlock]
21+
* link:cops_rspec.adoc#rspecbe[RSpec/Be]
22+
* link:cops_rspec.adoc#rspecbeeql[RSpec/BeEql]
23+
* link:cops_rspec.adoc#rspecbeforeafterall[RSpec/BeforeAfterAll]
24+
* link:cops_rspec.adoc#rspeccontextmethod[RSpec/ContextMethod]
25+
* link:cops_rspec.adoc#rspeccontextwording[RSpec/ContextWording]
26+
* link:cops_rspec.adoc#rspecdescribeclass[RSpec/DescribeClass]
27+
* link:cops_rspec.adoc#rspecdescribemethod[RSpec/DescribeMethod]
28+
* link:cops_rspec.adoc#rspecdescribesymbol[RSpec/DescribeSymbol]
29+
* link:cops_rspec.adoc#rspecdescribedclass[RSpec/DescribedClass]
30+
* link:cops_rspec.adoc#rspecdescribedclassmodulewrapping[RSpec/DescribedClassModuleWrapping]
31+
* link:cops_rspec.adoc#rspecdialect[RSpec/Dialect]
32+
* link:cops_rspec.adoc#rspecemptyexamplegroup[RSpec/EmptyExampleGroup]
33+
* link:cops_rspec.adoc#rspecemptyhook[RSpec/EmptyHook]
34+
* link:cops_rspec.adoc#rspecemptylineafterexample[RSpec/EmptyLineAfterExample]
35+
* link:cops_rspec.adoc#rspecemptylineafterexamplegroup[RSpec/EmptyLineAfterExampleGroup]
36+
* link:cops_rspec.adoc#rspecemptylineafterfinallet[RSpec/EmptyLineAfterFinalLet]
37+
* link:cops_rspec.adoc#rspecemptylineafterhook[RSpec/EmptyLineAfterHook]
38+
* link:cops_rspec.adoc#rspecemptylineaftersubject[RSpec/EmptyLineAfterSubject]
39+
* link:cops_rspec.adoc#rspecexamplelength[RSpec/ExampleLength]
40+
* link:cops_rspec.adoc#rspecexamplewithoutdescription[RSpec/ExampleWithoutDescription]
41+
* link:cops_rspec.adoc#rspecexamplewording[RSpec/ExampleWording]
42+
* link:cops_rspec.adoc#rspecexpectactual[RSpec/ExpectActual]
43+
* link:cops_rspec.adoc#rspecexpectchange[RSpec/ExpectChange]
44+
* link:cops_rspec.adoc#rspecexpectinhook[RSpec/ExpectInHook]
45+
* link:cops_rspec.adoc#rspecexpectoutput[RSpec/ExpectOutput]
46+
* link:cops_rspec.adoc#rspecfilepath[RSpec/FilePath]
47+
* link:cops_rspec.adoc#rspecfocus[RSpec/Focus]
48+
* link:cops_rspec.adoc#rspechookargument[RSpec/HookArgument]
49+
* link:cops_rspec.adoc#rspechooksbeforeexamples[RSpec/HooksBeforeExamples]
50+
* link:cops_rspec.adoc#rspecimplicitblockexpectation[RSpec/ImplicitBlockExpectation]
51+
* link:cops_rspec.adoc#rspecimplicitexpect[RSpec/ImplicitExpect]
52+
* link:cops_rspec.adoc#rspecimplicitsubject[RSpec/ImplicitSubject]
53+
* link:cops_rspec.adoc#rspecinstancespy[RSpec/InstanceSpy]
54+
* link:cops_rspec.adoc#rspecinstancevariable[RSpec/InstanceVariable]
55+
* link:cops_rspec.adoc#rspecinvalidpredicatematcher[RSpec/InvalidPredicateMatcher]
56+
* link:cops_rspec.adoc#rspecitbehaveslike[RSpec/ItBehavesLike]
57+
* link:cops_rspec.adoc#rspeciteratedexpectation[RSpec/IteratedExpectation]
58+
* link:cops_rspec.adoc#rspecleadingsubject[RSpec/LeadingSubject]
59+
* link:cops_rspec.adoc#rspecleakyconstantdeclaration[RSpec/LeakyConstantDeclaration]
60+
* link:cops_rspec.adoc#rspecletbeforeexamples[RSpec/LetBeforeExamples]
61+
* link:cops_rspec.adoc#rspecletsetup[RSpec/LetSetup]
62+
* link:cops_rspec.adoc#rspecmessagechain[RSpec/MessageChain]
63+
* link:cops_rspec.adoc#rspecmessageexpectation[RSpec/MessageExpectation]
64+
* link:cops_rspec.adoc#rspecmessagespies[RSpec/MessageSpies]
65+
* link:cops_rspec.adoc#rspecmissingexamplegroupargument[RSpec/MissingExampleGroupArgument]
66+
* link:cops_rspec.adoc#rspecmultipledescribes[RSpec/MultipleDescribes]
67+
* link:cops_rspec.adoc#rspecmultipleexpectations[RSpec/MultipleExpectations]
68+
* link:cops_rspec.adoc#rspecmultiplesubjects[RSpec/MultipleSubjects]
69+
* link:cops_rspec.adoc#rspecnamedsubject[RSpec/NamedSubject]
70+
* link:cops_rspec.adoc#rspecnestedgroups[RSpec/NestedGroups]
71+
* link:cops_rspec.adoc#rspecnottonot[RSpec/NotToNot]
72+
* link:cops_rspec.adoc#rspecoverwritingsetup[RSpec/OverwritingSetup]
73+
* link:cops_rspec.adoc#rspecpending[RSpec/Pending]
74+
* link:cops_rspec.adoc#rspecpredicatematcher[RSpec/PredicateMatcher]
75+
* link:cops_rspec.adoc#rspecreceivecounts[RSpec/ReceiveCounts]
76+
* link:cops_rspec.adoc#rspecreceivenever[RSpec/ReceiveNever]
77+
* link:cops_rspec.adoc#rspecrepeateddescription[RSpec/RepeatedDescription]
78+
* link:cops_rspec.adoc#rspecrepeatedexample[RSpec/RepeatedExample]
79+
* link:cops_rspec.adoc#rspecrepeatedexamplegroupbody[RSpec/RepeatedExampleGroupBody]
80+
* link:cops_rspec.adoc#rspecrepeatedexamplegroupdescription[RSpec/RepeatedExampleGroupDescription]
81+
* link:cops_rspec.adoc#rspecreturnfromstub[RSpec/ReturnFromStub]
82+
* link:cops_rspec.adoc#rspecscatteredlet[RSpec/ScatteredLet]
83+
* link:cops_rspec.adoc#rspecscatteredsetup[RSpec/ScatteredSetup]
84+
* link:cops_rspec.adoc#rspecsharedcontext[RSpec/SharedContext]
85+
* link:cops_rspec.adoc#rspecsharedexamples[RSpec/SharedExamples]
86+
* link:cops_rspec.adoc#rspecsingleargumentmessagechain[RSpec/SingleArgumentMessageChain]
87+
* link:cops_rspec.adoc#rspecsubjectstub[RSpec/SubjectStub]
88+
* link:cops_rspec.adoc#rspecunspecifiedexception[RSpec/UnspecifiedException]
89+
* link:cops_rspec.adoc#rspecvariabledefinition[RSpec/VariableDefinition]
90+
* link:cops_rspec.adoc#rspecvariablename[RSpec/VariableName]
91+
* link:cops_rspec.adoc#rspecverifieddoubles[RSpec/VerifiedDoubles]
92+
* link:cops_rspec.adoc#rspecvoidexpect[RSpec/VoidExpect]
93+
* link:cops_rspec.adoc#rspecyield[RSpec/Yield]
94+
95+
==== Department xref:cops_rails.adoc[Rails]
96+
97+
* link:cops_rails.adoc#railshttpstatus[Rails/HttpStatus]
98+
99+
// END_COP_LIST
Lines changed: 149 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,149 @@
1+
= Capybara
2+
3+
== Capybara/CurrentPathExpectation
4+
5+
|===
6+
| Enabled by default | Supports autocorrection
7+
8+
| Enabled
9+
| Yes
10+
|===
11+
12+
Checks that no expectations are set on Capybara's `current_path`.
13+
14+
The `have_current_path` matcher (https://www.rubydoc.info/github/
15+
teamcapybara/capybara/master/Capybara/RSpecMatchers#have_current_path-
16+
instance_method) should be used on `page` to set expectations on
17+
Capybara's current path, since it uses Capybara's waiting
18+
functionality (https://github.com/teamcapybara/capybara/blob/master/
19+
README.md#asynchronous-javascript-ajax-and-friends) which ensures that
20+
preceding actions (like `click_link`) have completed.
21+
22+
=== Examples
23+
24+
[source,ruby]
25+
----
26+
# bad
27+
expect(current_path).to eq('/callback')
28+
expect(page.current_path).to match(/widgets/)
29+
30+
# good
31+
expect(page).to have_current_path("/callback")
32+
expect(page).to have_current_path(/widgets/)
33+
----
34+
35+
=== References
36+
37+
* https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/Capybara/CurrentPathExpectation
38+
39+
== Capybara/FeatureMethods
40+
41+
|===
42+
| Enabled by default | Supports autocorrection
43+
44+
| Enabled
45+
| Yes
46+
|===
47+
48+
Checks for consistent method usage in feature specs.
49+
50+
By default, the cop disables all Capybara-specific methods that have
51+
the same native RSpec method (e.g. are just aliases). Some teams
52+
however may prefer using some of the Capybara methods (like `feature`)
53+
to make it obvious that the test uses Capybara, while still disable
54+
the rest of the methods, like `given` (alias for `let`), `background`
55+
(alias for `before`), etc. You can configure which of the methods to
56+
be enabled by using the EnabledMethods configuration option.
57+
58+
=== Examples
59+
60+
[source,ruby]
61+
----
62+
# bad
63+
feature 'User logs in' do
64+
given(:user) { User.new }
65+
66+
background do
67+
visit new_session_path
68+
end
69+
70+
scenario 'with OAuth' do
71+
# ...
72+
end
73+
end
74+
75+
# good
76+
describe 'User logs in' do
77+
let(:user) { User.new }
78+
79+
before do
80+
visit new_session_path
81+
end
82+
83+
it 'with OAuth' do
84+
# ...
85+
end
86+
end
87+
----
88+
89+
=== Configurable attributes
90+
91+
|===
92+
| Name | Default value | Configurable values
93+
94+
| EnabledMethods
95+
| `[]`
96+
| Array
97+
|===
98+
99+
=== References
100+
101+
* https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/Capybara/FeatureMethods
102+
103+
== Capybara/VisibilityMatcher
104+
105+
|===
106+
| Enabled by default | Supports autocorrection
107+
108+
| Enabled
109+
| No
110+
|===
111+
112+
Checks for boolean visibility in capybara finders.
113+
114+
Capybara lets you find elements that match a certain visibility using
115+
the `:visible` option. `:visible` accepts both boolean and symbols as
116+
values, however using booleans can have unwanted effects. `visible:
117+
false` does not find just invisible elements, but both visible and
118+
invisible elements. For expressiveness and clarity, use one of the
119+
symbol values, `:all`, `:hidden` or `:visible`.
120+
(https://www.rubydoc.info/gems/capybara/Capybara%2FNode%2FFinders:all)
121+
122+
=== Examples
123+
124+
[source,ruby]
125+
----
126+
# bad
127+
expect(page).to have_selector('.foo', visible: false)
128+
expect(page).to have_css('.foo', visible: true)
129+
expect(page).to have_link('my link', visible: false)
130+
131+
# good
132+
expect(page).to have_selector('.foo', visible: :visible)
133+
expect(page).to have_css('.foo', visible: :all)
134+
expect(page).to have_link('my link', visible: :hidden)
135+
----
136+
137+
=== Configurable attributes
138+
139+
|===
140+
| Name | Default value | Configurable values
141+
142+
| VersionAdded
143+
| `1.39`
144+
| String
145+
|===
146+
147+
=== References
148+
149+
* https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/Capybara/VisibilityMatcher

0 commit comments

Comments
 (0)