Why does Rubymonkey makes this true

<meta http-equiv="content-type" content="text/html; 

charset=ISO-8859-1">

hello,

I have this :

def kaprekar?(k)
  string_k = (k * k).to_s
  length_k = k.to_s.length.to_i
  length_k2 = string_k.to_s.length.to_i
  number1 = string_k[0...length_k].to_i
  number2 = string_k[length_k..length_k2].to_i
  number1 + number2 == k
end

and according to this error message  for 297 it output is true.

returns true for 297
RSpec::Expectations::ExpectationNotMetError
expected false to be true

But when I do the same on repl.it I see this output :

kaprekar?(297)

string_k : 88209
length_k : 3
length2 : 5
number1 : 882
number2: 9
=> false

which is the right answer.
Can anyone explain why Rubymonk say the outcome is true.

Roelof