1
运行依赖于另一场景的场景的最佳方式是什么?如何在Rails Capybara测试的另一个场景之前运行场景
scenario 'create a new category' do
index_page.open
index_page.click_new_category
modify_page.fill_form_with(category_params)
modify_page.submit
expect(index_page.flash).to have_css('.alert-success')
expect(index_page.entry(1)).to have_content(category_params[:name_de])
end
这个“创建一个新的类别”之前必须另一个场景“编辑类别”做就可以开始:
scenario 'edit category' do
index_page.open
index_page.click_new_category
modify_page.fill_form_with(category_params)
modify_page.submit
index_page.open
index_page.click_edit_category
modify_page.fill_form_with(category_params)
modify_page.submit
expect(index_page).to have_css('.alert-success')
end
是否有一个快捷方式,以消除前4行中的“编辑类”方案?