我正在尝试测试使用RTF红宝石创建的文档的内容,但不知道如何从文档中提取实际内容。
我想测试的方法
class Writer
def document
d = RTF::Document.new(RTF::Font.new(RTF::Font::ROMAN, 'Times New Roman'))
d.paragraph << "blah blah some text"
d
end
end测试
describe Writer do
let(:doc) { Writer.new }
it "should contain 'blah'" do
doc.should match "blah"
end
end但是RTF::Document没有match方法或to_s方法。
如何询问RTF文档的原始内容?
发布于 2014-09-17 05:11:20
使用to_rtf方法如下
doc.to_rtf.should match "blah"https://stackoverflow.com/questions/25882683
复制相似问题