我是Rspec的新手,在这里我试图测试一个集成测试.当我(使用Capybara)单击按钮时,页面内容将被替换为后期响应.现在我正在检查页面内容,它出现在页面上,但我的测试仍然失败.以下是规格
it "get force check takeover1" do
visit('/las_xml')
select('Showroom', :from => 'urlVal')
fill_in('fpHeaderForce', :with => 'PSD.L.Syn')
fill_in('currentDate', :with => '2013-09-11')
click_button('submit')
page.should have_content('Buy 2013 Labor Law Posters')
end
Run Code Online (Sandbox Code Playgroud)
但结果是,
1) las box get force check takeover1
Failure/Error: page.should have_content('Test page')
expected #has_content?("Buy 2013 Labor Law Posters") to return true, got false
# ./integration/las_box_spec.rb:19:in `block (2 levels) in <top (required)>'
Run Code Online (Sandbox Code Playgroud)
和结果响应html包含,
<div class="las-link" id="">
<div class="laborLink_actual labor_01">
<span class="laborLink"></span>
<a href="#">Buy 2013 Labor Law Posters</a>
</div>
</div>
Run Code Online (Sandbox Code Playgroud)