1. 6

Even though described_class is widely used, it’s confusing in some cases, e.g.:

RSpec.describe SomeClass do
  describe controller: true do
    it { expect(described_class).to eq(SomeClass) }
  end
end

results in:

1) SomeClass {:controller=>true} should eq SomeClass
   Failure/Error: it { expect(described_class).to eq(SomeClass) }

     expected: SomeClass
          got: {:controller=>true}

described_class is seen as confusing and ambiguous, and is discouraged to be used by RSpec Core team.

Read more on the Ruby in Style blog post and RSpec style guide GitHub issue.

Post comments and vote on GitHub issue how you see the future use of described_class.

Short update about the results of the previous discussion, RSpec implicit block expectation syntax:

  1.