RSpec.describe vs describe

rspec, ruby, ruby-on-rails

Solution

As of RSpec 3 you can disable the global availability of `describe` by limiting the domain specific language (dsl).

Prefixing with `RSpec.describe` ensures tests will still run after implementing the limitation.

Note: you still don't need the prefix, unless you turn off the availability with `config.expose_dsl_globally = false`

Edit: link to dsl wikipedia

Problem

I'm starting a new Rails project for the first time in a while. When scaffolding a model, Rspec creates describe blocks predicated with "RSpec" ``` RSpec.describe MyModel do ... end ``` vs the old style: ``` describe MyModel do ... end ``` I've perused the change log but must be missing the rational for the change?

Original source