2017-06-22 40 views
0

我有幾個測試,我使用Rspec運行。如何在Rspec控制檯輸出的測試之間添加換行符?

輸出結果看起來大概如下:

returns an array containing partial words that have changed their case(upper/lower), 
and have matching partial words in opposite elements(ins/del) 
returns an array containing words that have changed their case(upper/lower), 
and have matching whole words in opposite elements(ins/del) 
returns an array containing words that have changed their case(upper/lower), are at the start of a sentence, 
and have matching words in opposite elements(ins/del) 
returns an array containing partial words that have changed their case(uppler/lower), have matching partial words in opposite elements(ins/del), 
and are preceded by an inserted word 

我想有一個換行分隔每個測試,使其更容易爲我讀輸出。我曾嘗試添加「\ n」,但它似乎不起作用。

任何想法?

+0

您在哪裏試圖放置'\ n'? –

+0

我把它放在測試說明的末尾。例如它「返回一個數組... \ n」但這不起作用 – chell

+0

如果它是在雙引號'「\ n」'它應該可能工作... –

回答

0

可以使用紅寶石輸出命令打印或看跌期權,以獲得測試 打印期權和看跌期權之間的差異之間的換行,打印不會自動給換行,但看跌期權會自動給 下面是示例代碼

print "test = ", variable , ".\n" 
puts "test = ", variable 

上述兩個命令都會在執行每個命令後給出換行符

+0

我會在哪裏把它放在Rspec測試中? – chell

相關問題