Skip to content

Commit

Permalink
Merge pull request #2629 from pirj/fix-described_class-in-nested-exam…
Browse files Browse the repository at this point in the history
…ples-doc

Fix documentation for nested described_class
  • Loading branch information
myronmarston committed May 27, 2019
2 parents b4af5c7 + 861986d commit d04d4de
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
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

0 comments on commit d04d4de

Please sign in to comment.