我想運行黃瓜使用錄像機寶石,鉻驅動程序和webmock,但它不工作。一個問題是無的請求正在被記錄。我確實有錄像機設置爲ignore_localhost
,我相信這是由於javascript SO answer解釋所需要的。黃瓜,錄像機寶石和鉻驅動器不一起工作
但爲什麼我的步驟請求訪問一個url(比如說www.test.com
)得到記錄?我看到chrome瀏覽器加載並在URL中的地址,所以我知道黃瓜步驟是去那裏。
如果我關掉ignore_localhost
然後我看到一些錄音,但是uri的全部都是127.0.0.1
。我期望的uri顯示在body: string
而不是uri
。 這是怎麼發生的?
request:
method: post
uri: http://127.0.0.1:9592/session/87bb12aa8b5b1230399b98bcc7d0ba11/url
body:
encoding: US-ASCII
string: ! '{"url":"http://www.test.com"}'
headers:
Accept:
- application/json
Content-Type:
- application/json; charset=utf-8
Content-Length:
- '46'
User-Agent:
- Ruby
櫃面有幫助,這是我的錄像機配置
VCR.configure do |c|
c.cassette_library_dir = 'features/support/vcr_cassettes'
c.hook_into :webmock
c.ignore_localhost = true
end