expect_evaluate_ruby { 12 + 12 }
.to eq(24)
does not work.
its because when we get the source code for the block it will include any expressions on the same line. So if you say expect_evaluate_ruby { 12 + 12 }.to eq(24) the tree includes the send(:to) part of the tree.
The solution is to repeatedly do .children.first until we find the block.
does not work.
its because when we get the source code for the block it will include any expressions on the same line. So if you say
expect_evaluate_ruby { 12 + 12 }.to eq(24)the tree includes the send(:to) part of the tree.The solution is to repeatedly do .children.first until we find the block.