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

Fix documentation for nested described_class #2629

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 8 additions & 5 deletions features/metadata/described_class.feature
Original file line number Diff line number Diff line change
@@ -1,17 +1,20 @@
Feature: described class

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

Scenario: Access the described class from the example
Given a file named "spec/example_spec.rb" with:
"""ruby
RSpec.describe Fixnum do
it "is available as described_class" do
expect(described_class).to eq(Fixnum)
describe 'inner' do
describe String do
it "is available as described_class" do
expect(described_class).to eq(String)
end
end
end
end
"""
When I run `rspec spec/example_spec.rb`
Then the example should pass

5 changes: 3 additions & 2 deletions features/subject/implicit_subject.feature
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
Feature: implicitly defined subject

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

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