Validating the presence of properties in a document
If your tests are about mandatory members in @opts you can do this:

MandatoryProperties = [:property_1, :property_2, ...]

def valid?
  @opts &amp;&amp; MandatoryProperties.all? { |k| !@opts[k].nil? }
end