method
described_class
1.2.8 -
Show latest stable
-
1 note -
Class: Spec::Example::ExampleGroupMethods
- 1.1.4
- 1.1.12
- 1.2.0 (0)
- 1.2.8 (0)
- 1.3.0 (0)
- 1.3.1 (0)
- What's this?
Register or
log in
to add new notes.
vishnunarang -
December 9, 2013 - (1.3.0 - 1.3.1)
0 thanks
description for described_class
Here is an example to understand described_class
If while describing the rspec, we use a Class name in the describe part, we can use described_class method to refer to that and use it as a class in the specs within that description.
Example:
describe MyClass do it "is available as described_class" do expect(described_class).to eq(MyClass) end end
So in the above example, described_class method will return MyClass as a class.
It is a part of rspec core 3.0
Reference: http://www.relishapp.com/rspec/rspec-core/docs/metadata/described-class