title: In RSpec, how to expect that a header is included in a list of acceptable values?
body: <p>I am trying to write a spec which asserts that HTTP headers from an API call are all included in a list of acceptable headers (with acceptable values, also).</p>
  
  <p>I ended up writing something like this:</p>
  
  <pre><code>expect(response.headers).to all(be_included_in(acceptable_headers))
  </code></pre>
  
  <p>where <code>be_included_in</code> is a custom matcher:</p>
  
  <pre><code>RSpec::Matchers.define :be_included_in do |enumerable|
    match do |element|
      enumerable.include?(element)
    end
  end
  </code></pre>
  
  <p>This works well for asserting that headers are all in an included range, but does not satisfy the requirement of testing their values for acceptance.</p>
  
  <p>Any ideas how to do this elegantly?</p>