rspec expectations are a gem that should added to every object. The rspec request rspec loads the rspec metacharacter (which exists solely as one gem install , which provides all rspec), but does not automatically load rspec expectations. rspec-core allows you to configure it to use something other than rspec expectations if you want (e.g. stdlib statements provided by minitest or incorrect), but it loads rspec expectations by default. To achieve this, if you have not explicitly configured it, it expects rspec-expectations to load before the first call to describe for historical reasons, as explained in my blog post .
So, if you want to do Object#should immediately, you just need to require rspec/expectations . Please note that we plan to change the default value in RSpec 4 so that it should not be automatically available without additional configuration. Also, as mentioned in @JonRowe, this use is not really intended use. You can call foo.should from any context, but matching methods designed to work with should not be available in all contexts. You must include RSpec::Matchers in your context to make them available. Consider also switching to expect syntax: this is a newer, non-monkeypatching syntax, which we recommend for a while .
source share