我正在关注Rails教程.. 这是我的测试文件
require 'test_helper'
class StaticPagesControllerTest < ActionDispatch::IntegrationTest
def setup
@base_title = "Ruby on Rails Tutorial Sample App"
end
test "should get home" do
get static_pages_home_url
assert_response :success
assert_select "title", "Home | #{@base_title}"
end
test "should get help" do
get static_pages_help_url
assert_response :success
assert_select "title", "Help | #{@base_title}"
end
test "should get about" do
get static_pages_about_url
assert_response :success
assert_select "title", "About | #{@base_title}"
end
end
这是我收到的错误消息:
Failure:
StaticPagesControllerTest#test_should_get_home
[c:/Sites/workspace/sample_app/te
st/controllers/static_pages_controller_test.rb:12]:
<Home | Ruby on Rails Tutorial Sample App> expected but was
<Home>..
Expected 0 to be >= 1.
请注意,错误有时会显示“关于/帮助”而不是“家庭”。
顺便说一句,当我在第5到7行注释掉并在每个测试中替换#{@ base_title}时,rails测试结果就成功了。
与此处发生的事情完全冲突。