rails tutorialの6章をやっているのですがrails testを行うと
Error: UsersControllerTest#test_should_get_new: NoMethodError: undefined method `each' for nil:NilClass StaticPagesControllerTest#test_should_get_about: NoMethodError: undefined method `each' for nil:NilClass
という二つのエラーが出てしまいます。
どの様に解決すればよいでしょうか?
users_controller_test.rb
1require 'test_helper' 2 3class UsersControllerTest < ActionDispatch::IntegrationTest 4 test "should get new" do 5 get signup_path 6 assert_response :success 7 end 8 9end
sample_pages_controller_test.rb
1require 'test_helper' 2class StaticPagesControllerTest < ActionDispatch::IntegrationTest 3 def setup 4 @base_title= "Ruby on Rails Tutorial Sample App" 5 end 6 test "should get home" do 7 get root_path 8 assert_response :success 9 assert_select "title", "Ruby on Rails Tutorial Sample App" 10 end 11 12 test "should get help" do 13 get help_path 14 assert_response :success 15 assert_select "title", "Help | #{@base_title}" 16 end 17 test "should get about" do 18 get about_path 19 assert_response :success 20 assert_select "title", "About | #{@base_title}" 21 end 22 test "should get contact" do 23 get contact_path 24 assert_response :success 25 assert_select "title", "Contact | #{@base_title}" 26 end 27 28end
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2022/05/12 05:42
退会済みユーザー
2022/05/12 06:59
2022/05/12 07:14
退会済みユーザー
2022/05/12 07:23
2022/05/12 07:46
退会済みユーザー
2022/05/12 08:11 編集
2022/05/12 09:11
2022/05/12 12:16
2022/05/12 13:30
2022/05/12 13:55
2022/05/12 23:25