我正在使用 Rspec 和 gem file_validators 进行测试,我需要正确放置引号(“txt”)的输出,如下所示:
expect(page).to have_content expect(page).to have_content "You are not allowed to upload \"txt\" files, allowed types: jpg, jpeg, gif, png"
或者
double_quotes = ""txt"".html_safe
expect(page).to have_content expect(page).to have_content "You are not allowed to upload #{double_quotes} files, allowed types: jpg, jpeg, gif, png"
但是我有一个失败错误来显示这个:
Failure/Error: expect(page).to have_content expect(page).to have_content "You are not allowed to upload #{double_quotes} files, allowed types: jpg, jpeg, gif, png"
expected to find text "You are not allowed to upload "txt" files, allowed types: jpg, jpeg, gif, png" in "News CityToggle navigationHomeAdminSigned in as rubie@fayvon.netSign out×Post has not been created.New Post* TitleSubtitleFileYou are not allowed to upload \"txt\" files, allowed types: jpg, jpeg, gif, png* Content It will serve for show images about the posts."
有人可以帮我解决这个问题吗?整个输出需要如下所示:
You are not allowed to upload "rtf" files, allowed types: jpg, jpeg, gif, png