You can actually have RSpec matchers outside "it" blocks. You just need to include RSpec::Matchers.
[ ~/work/mobile_server (master)]$ irb>> require 'rspec'true>> include RSpec::MatchersObject < BasicObject>> {a: 1}.should have_key(:a)true
You need to actually do this inside an RSpec example, I don't think you can write that kind of code anywhere.
describe "" do it "has a key" do ... endend