Skip to content
This repository was archived by the owner on Nov 30, 2024. It is now read-only.

Commit 861986d

Browse files
committed
Fix documentation for nested described_class
Fixes #2627 Documentation for `described_class` was out of date, a change was made in early 3.0 in #1361, but was not reflected to the docs. Also, documentation for implicit `subject` was off, even though there is a feature describing how it behaves.
1 parent b4af5c7 commit 861986d

File tree

2 files changed

+11
-7
lines changed

2 files changed

+11
-7
lines changed

features/metadata/described_class.feature

+8-5
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,20 @@
11
Feature: described class
22

3-
If the first argument to the outermost example group is a class, the class is
4-
exposed to each example via the `described_class()` method.
3+
If the first argument to an example group is a class, the class is exposed to
4+
each example in that example group via the `described_class()` method.
55

66
Scenario: Access the described class from the example
77
Given a file named "spec/example_spec.rb" with:
88
"""ruby
99
RSpec.describe Fixnum do
10-
it "is available as described_class" do
11-
expect(described_class).to eq(Fixnum)
10+
describe 'inner' do
11+
describe String do
12+
it "is available as described_class" do
13+
expect(described_class).to eq(String)
14+
end
15+
end
1216
end
1317
end
1418
"""
1519
When I run `rspec spec/example_spec.rb`
1620
Then the example should pass
17-

features/subject/implicit_subject.feature

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
Feature: implicitly defined subject
22

3-
If the first argument to the outermost example group is a class, an instance
4-
of that class is exposed to each example via the `subject` method.
3+
If the first argument to an example group is a class, an instance of that
4+
class is exposed to each example in that example group via the `subject`
5+
method.
56

67
While the examples below demonstrate how `subject` can be used as a
78
user-facing concept, we recommend that you reserve it for support of custom

0 commit comments

Comments
 (0)