ユーザーがフォームに入力して新しいプロジェクトを作成できることをテストしたいとします。私が訪問する必要があるルートは:new_user_project_path(:user_id)
です。
したがって、私の機能 rspec は現在次のようになっています。
feature "User creates a project" do
scenario "Logged in User creates a project" do
login_with_oauth #this sets current_user
visit new_user_project_path
fill_in 'Title', :with => 'Colchasdadasdasoneta'
fill_in 'Description', :with => 'lalalssalsalas'
click_in 'Create Project'
end
end
おわかりのように、:user_id を渡す必要があるため、この訪問 new_user_project_path は使用できません。私の質問は、どうすれば current_user にアクセスできますか? または、この種のものをテストする正しい方法は何ですか?