我有两个水豚测试,其中第一个用户签名,第二个旨在测试只有登录用户可用的功能。与Capybara和Rails保持会话3
但是,由于会话没有在测试中维护(显然,它应该是),我无法获得第二个测试工作。
require 'integration_test_helper'
class SignupTest < ActionController::IntegrationTest
test 'sign up' do
visit '/'
click_link 'Sign Up!'
fill_in 'Email', :with => '[email protected]'
click_button 'Sign up'
assert page.has_content?("Password can't be blank")
fill_in 'Email', :with => '[email protected]'
fill_in 'Password', :with => 'password'
fill_in 'Password confirmation', :with => 'password'
click_button 'Sign up'
assert page.has_content?("You have signed up successfully.")
end
test 'create a product' do
visit '/admin'
save_and_open_page
end
end
由save_and_open_page调用生成的页面是全局登录屏幕,而不是管理员的首页做为我希望(在注册登录你)。我在这里做错了什么?