module Expectations
  def expect_code_with_result(string)
    code, result = string.split('#=>').map(&:strip)

    expect(eval_in_page(code)).to eq eval(result)
  end
end

World Expectations

module Expectations
  def expect_code_with_result(string, evaluator = :eval_in_page)
    code, result = string.split('#=>').map(&:strip)

    expect(send(evaluator, code)).to eq eval(result)
  end
end

World Expectations

Allow passing a custom evaluator.
[tests] Allow passing a custom evaluator.
