When tests might not run with skipping RSpec
in the RSpec.describe
failing with the error undefined method 'describe' for main:Object
this card will help you out!
In RSpec 3 the DSL like describe
is
exposed globally
Show archive.org snapshot
by default. Therefore it is not necessary to write Rspec.describe
.
However, there is a config option to disable this beavior, which also disables the old should
-syntax:
RSpec.configure do |config|
config.disable_monkey_patching!
end
In order to still use describe
without Rspec
, you can set expose_dsl_globally = true
after disable_monkey_patching!
:
RSpec.configure do |config|
config.disable_monkey_patching!
config.expose_dsl_globally = true
end
Posted by Daniel Straßner to makandra dev (2019-12-05 10:40)