class RSpec::Matchers::BuiltIn::Compound::NestedEvaluator

def order_block_matchers

should be the outer matcher.
This method figures out which matcher should be the inner matcher and which

`raise_error` logic, so only the former case will work properly.
get executed because the `raise "boom"` line would jump to the `rescue` in the
In the latter case, the after-block logic in the `change` matcher would never

}.to raise_error("boom")
}.to change { x }.by(1)
raise "boom"
x += 1
expect {
expect {

...rather than:

}.to change { x }.by(1)
}.to raise_error("boom")
raise "boom"
x += 1
expect {
expect {

For example, we need it to be this:
up the call stack, we need to order things so that it is the inner matcher.
For a matcher like `raise_error` or `throw_symbol`, where the block will jump
def order_block_matchers
  return @matcher_1, @matcher_2 unless self.class.matcher_expects_call_stack_jump?(@matcher_2)
  return @matcher_2, @matcher_1 unless self.class.matcher_expects_call_stack_jump?(@matcher_1)
  raise ArgumentError, "(#{@matcher_1.description}) and " \
    "(#{@matcher_2.description}) cannot be combined in a compound expectation " \
    "because they both expect a call stack jump."
end