按照我的方式完成 Hartle 的教程;我正在为他的演练示例应用程序设置开发环境。RSpec 没有通过测试,而我认为它应该通过;这让我相信当然有一些我不知道的东西正在窃听。
失败:
失败:
1) 静态页面首页应该有内容 'Sample App' Failure/Error: visit '/static_pages/home' NoMethodError: undefined method visit' for #<RSpec::Core::ExampleGroup::Nested_1::Nested_1:0x007fb0f97a9d90>
# ./spec/requests/static_pages_spec.rb:8:in
block (3 levels) in '
在 0.00289 秒内完成 1 个示例,1 个失败
失败的例子:
rspec ./spec/requests/static_pages_spec.rb:7 # 静态页面主页应该有内容'Sample App'
家:
is the home page for the
<a href="http://railstutorial.org/">Ruby on Rails Tutorial</a>
sample application.
</p>
static_pages_spec 文件:
require 'spec_helper'
describe "Static pages" do
describe "Home page" do
it "should have the content 'Sample App'" do
visit '/static_pages/home'
expect(page).to have_content('Sample App')
end
end
end