我有一个div将从用户选择的URL接收CSS背景图像,如下所示:
background-image: url("/* user specified URL here*/")
我应该如何转义URL,以便可以安全地嵌入CSS?是否足够逃避报价?
在使用RSpec 3和Capybara的Rails 4功能规范中,如何断言页面中是否存在一定数量的特定标签?
我试过了:
expect(find('section.documents .document').count).to eq(2)
Run Code Online (Sandbox Code Playgroud)
但这是行不通的,它说:
Ambiguous match, found 2 elements matching css "section.documents .document"
Run Code Online (Sandbox Code Playgroud)
另外,在功能规范中测试某些特定的东西(例如视图中使用的标记和类)是否是个好主意/不好的做法?