Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在使用构建器生成一些 XML,并希望将结果与一些文件内容进行比较。但是,由于字符串很长,当字符串不同时,输出很难读取。
我知道 ruby 中有许多用于区分字符串的库,但是 rspec 中是否有内置工具可以生成更易于阅读的多行字符串比较失败?
好,知道了。您需要将 --diff 选项与以下内容一起使用:
actual_multiline_string.should == expected_multiline_string
不是
actual_multiline_string.should eql(expected_multiline_string)