`described_class` is overridden in nested example group
Created by: pirj
Subject of the issue
The following spec file:
module A; end
module B; end
RSpec.describe A do
describe B do
it { expect(described_class.name).to eq('B') }
end
end
passes.
described_class
docs mention:
If the first argument to the outermost example group is a class, the class is exposed to each example via the described_class() method.
Your environment
- Ruby version: 2.5.5
- rspec-core version: 3.8.2
Steps to reproduce
Run the spec from description.
Expected behavior
Example fails:
Failures:
1) A B should eq "B"
Failure/Error: it { expect(described_class.name).to eq('B') }
expected: "B"
got: "A"
Actual behavior
Example is green.