私は2つのカピバラテストを行っています。最初はユーザにサインインし、2番目はログインしたユーザだけがテストできる機能です。CapybaraとRailsでセッションを維持する3
しかし、セッション間でセッションが維持されていないため、2番目のテストを実行することはできません(明らかにそうであるはずです)。
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呼び出しによって生成されたページは、グローバルログイン画面ではなく、管理者のホームページです。私はここで間違って何をしていますか?