我正在尝试使用 rspec 和 capybara 测试登录表单,如果用户选中remember me
复选框然后他关闭浏览器并再次重新打开它,他仍然连接,这里我的测试看起来像:
it "still connected if remember me is checked" do
user = FactoryGirl.create(:user)
fill_in "Email", with: user.email
fill_in "Password", with: user.password
check "Remember me"
click_button submit
page.should have_link("sign out", signout_path)
# here i should do something to close the browser
visit signin_path
page.should have_link("Sign out", signout_path)
end
我正在搜索如何使用 capybara 关闭浏览器,但任何解决方案都适合我,有一种简单的方法可以做到这一点吗?