簡體   English   中英

在 rails 4.2 中的 assert_select 中執行轉義插值時出錯

[英]Error while doing escape interpolation inside assert_select in rails 4.2

我正在開發一個目前在 rails-4.2.10 中的項目,我想做這樣的事情:

assert_select ".note-nid-#{node.id}", false

但是在測試它時會彈出錯誤:

ArgumentError: wrong number of arguments (given 3, expected 1)

而如果我嘗試:

assert_select '.note-nid-#{node.id}', false

沒有錯誤彈出。 所以基本上我如何在 rails 4.2 中的 assert_select 中進行轉義插值

我已經找到了這個問題的答案。 我們可以通過

selector = css_select ".note-nid-#{node.id}"

assert_equal selector.size, 0

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM