-
-
Notifications
You must be signed in to change notification settings - Fork 757
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2629 from pirj/fix-described_class-in-nested-exam…
…ples-doc Fix documentation for nested described_class
- Loading branch information
Showing
2 changed files
with
11 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters