You're working with floats, which you can't reliably compare with ==. Check out assert_in_delta instead.