RSPEC Question In Methods Exercises

I was wondering if someone could explain the last RSPEC in the Methods Exercises?

it “doesn’t use the % operator” do
a = double(“Integer”, :confused: => 1, :to_f => 2.0)
expect(a).not_to receive(:%)
int_remainder_without_modulo(a, 2)
end

What does this part:

a = double(“Integer”, :confused: => 1, :to_f => 2.0)
expect(a).not_to receive(:%)
int_remainder_without_modulo(a, 2)

accomplish? Totally confused by this rspec…

Thank you!

Lucas

Hi Lucas,

I have some puzzlement here, too. I took it to be trying to enforce that you not use the modulus % operator in your answer to int_remainder_without_modulo. I have a comment in my answer indicating my confusion, though: I have one answer that failed that test, despite not using the % operator.

I hit on a passing answer by trying a different approach to the problem. Tricky to say more while only giving a hint. Does that help some? If not, follow up?

Best,

Brian

Thanks Brian, i’ll try a different approach as well.