###前提・実現したいこと
ページごとにタイトル名を変更する
###発生している問題・エラーメッセージ
static_pages_controller_test内に require 'test_helper' class StaticPagesControllerTest < ActionDispatch::IntegrationTest test "should get home" do get static_pages_home_url assert_response :success assert_select "title", "Ruby on Rails Tutorial Sample App" end test "should get help" do get static_pages_help_url assert_response :success assert_select "title", "Help | Ruby on Rails Tutorial Sample App" end test "should get about" do get static_pages_about_url assert_response :success assert_select "title", "About | Ruby on Rails Tutorial Sample App" end end を記入すると rails testの結果として Failure: StaticPagesControllerTest#test_should_get_home [/home/ubuntu/workspace/sample_app/test/controllers/static_pages_controller_test.rb:9]: <Ruby on Rails Tutorial Sample App> expected but was <| Ruby on Rails Tutorial Sample App>.. Expected 0 to be >= 1. が返されてします 確認のため、ApplicationHelperを見ても module ApplicationHelper # ページごとの完全なタイトルを返します。 def full_title(page_title = '') base_title = "Ruby on Rails Tutorial Sample App" if page_title.empty? base_title else page_title + " | " + base_title end end end と記述されているので、間違いないと思うが、 どうしてもhomeページのタイトルが”| Ruby on Rails Tutorial Sample App”と返されてしまいます。
###補足情報(言語/FW/ツール等のバージョンなど)
より詳細な情報
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。