我继续运行此测试并且它一直失败,但我找不到错误。失败消息是:
[故障: StaticPagesControllerTest#test_should_get_contact [/ Users / iThompkins / Documents / SiteDev / environment / sample_app / test / controlle RS / static_pages_controller_test.rb:26]:
<Contact | Ruby on Rails Tutorial Sample App> expected but was
<Ruby on Rails Tutorial Sample App>..
Expected 0 to be >= 1.]
我的测试如下:
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
test "should get contact" do
get static_pages_contact_url
assert_response :success
assert_select "title", "Contact | Ruby on Rails Tutorial Sample App"
end
end
我的控制器
class StaticPagesController < ApplicationController
def home
end
def help
end
def about
end
def contact
end
end
和我的观点
<% provide(:title, 'Contact') %>
请联系Ruby on Rails教程,了解有关示例应用程序的信息 contact page。
答案 0 :(得分:0)
您的观点的标题部分是否有print (df.stack())
0 Value1 0.0
Value2 1.0
1 Value1 2.0
Value2 4.0
2 Value2 3.0
dtype: float64
?
<%= yield(:title) %>
从Hartl book开始,您需要生成标题值才能显示它。