This repository was archived by the owner on Nov 30, 2024. It is now read-only.
File tree 2 files changed +11
-7
lines changed
2 files changed +11
-7
lines changed Original file line number Diff line number Diff line change 1
1
Feature : described class
2
2
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.
5
5
6
6
Scenario : Access the described class from the example
7
7
Given a file named "spec/example_spec.rb" with:
8
8
"""ruby
9
9
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
12
16
end
13
17
end
14
18
"""
15
19
When I run `rspec spec/example_spec.rb`
16
20
Then the example should pass
17
-
Original file line number Diff line number Diff line change 1
1
Feature : implicitly defined subject
2
2
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.
5
6
6
7
While the examples below demonstrate how `subject` can be used as a
7
8
user-facing concept, we recommend that you reserve it for support of custom
You can’t perform that action at this time.
0 commit comments