我正在编写测试并验证一些数据。\\
由于我在预期的数据字符串中得到了两个,它失败了。
我的测试代码是:
actual_string.should eq 'Today is Tuesday.\n It is third day of the week.'
当我执行此代码时,我收到一条错误消息,指出实际数据与预期数据不匹配。
实际数据是:
'Today is Tuesday.\n It is third day of the week.'
预期数据为:
'Today is Tuesday.\\n It is third day of the week.'
不确定预期数据中额外的斜杠“\”是从哪里来的。我该如何解决这个问题?