您好我现在正在第8章micheal hartl Learning Rails第3版。 目前我因为上述错误而陷入第8章。如果somebuddy帮助我,我会非常感激。提前致谢
当我运行bundle exec rake test时,它会出现
sample_app git:(log-in-log-out) ✗ bundle exec rake test
Run options: --seed 16515
# Running:
......E............
Finished in 0.944425s, 20.1181 runs/s, 40.2361 assertions/s.
1) Error:
SiteLayoutTest#test_layout_links:
NoMethodError: undefined method `full_title' for #<SiteLayoutTest:0x007ff8bea694b0>
test/integration/site_layout_test.rb:12:in `block in <class:SiteLayoutTest>'
19 runs, 38 assertions, 0 failures, 1 errors, 0 skips
而我的文件包含以下内容
require 'test_helper'
class SiteLayoutTest < ActionDispatch::IntegrationTest
test "layout links" do
get root_path
assert_template 'static_pages/home'
assert_select "a[href=?]", root_path, count: 2
assert_select "a[href=?]", help_path
assert_select "a[href=?]", about_path
assert_select "a[href=?]", contact_path
get signup_path
assert_select "title", full_title("Sign up")
end
end
答案 0 :(得分:0)
full_title
是application_helper.rb
中定义的辅助方法。查看https://www.railstutorial.org/book/_single-page#code-title_helper