Ruby,点击Cucumber中的链接时录制VCR卡带

时间:2013-02-16 06:08:09

标签: cucumber capybara vcr

我有这个:

@javascript
Given A

Given /$A^/ do
  VCR.use_cassette 'a_cassette' do
     click_link 'a_link' # This makes an AJAX request to external server
  end
end

不记录磁带,I can't use tag,需要在步骤定义中完成。

1 个答案:

答案 0 :(得分:2)

我使用了睡眠并为我工作。

Given /$A^/ do
  VCR.use_cassette 'a_cassette' do
     click_link 'a_link' # This makes an AJAX request to external server
     sleep 3
  end
end

更新

click_link 'a_link'
page.should have_content 'some content'

# some model assertion

page致电Capybara will wait