Skip to content

Commit

Permalink
[core] Merge pull request rspec/rspec-core#2629 from pirj/fix-describ…
Browse files Browse the repository at this point in the history
…ed_class-in-nested-examples-doc

Fix documentation for nested described_class

---
This commit was imported from rspec/rspec-core@d04d4de.
  • Loading branch information
myronmarston committed May 27, 2019
2 parents 00101c8 + ec173f9 commit 4864163
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
13 changes: 8 additions & 5 deletions rspec-core/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 rspec-core/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

0 comments on commit 4864163

Please sign in to comment.