method

described_class

Importance_1
described_class() public

No documentation

This method has no description. You can help the RSpec community by adding new notes.

Show source
Register or log in to add new notes.
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