Ruby on rails Rails教程:第3课添加静态&x27;关于';页
我正在完成Michael Hartl的RoR教程,我是“3.2.2-添加页面” 当试图Ruby on rails Rails教程:第3课添加静态&x27;关于';页,ruby-on-rails,ruby-on-rails-3,rspec,Ruby On Rails,Ruby On Rails 3,Rspec,我正在完成Michael Hartl的RoR教程,我是“3.2.2-添加页面” 当试图捆绑exec rspec spec/requests/static\u pages\u spec.rb时,即使我已经按照教程做了所有事情(所有页面都应该到位等),我还是会遇到以下错误: spec/requests/static\u pages\u spec.rb <h1>About Us</h1> <p> The <a href="http://railstutor
捆绑exec rspec spec/requests/static\u pages\u spec.rb时,即使我已经按照教程做了所有事情(所有页面都应该到位等),我还是会遇到以下错误:
spec/requests/static\u pages\u spec.rb
<h1>About Us</h1>
<p>
The <a href="http://railstutorial.org/">Ruby on Rails Tutorial</a>
is a project to make a book and screencasts to teach web development
with <a href="http://rubyonrails.org/">Ruby on Rails</a>. This
is the sample application for the tutorial.
</p>
class StaticPagesController < ApplicationController
def home
end
def help
end
def about
end
end
SampleApp::Application.routes.draw do
get "static_pages/home"
get "static_pages/help"
get "static_pages/about"
.
.
.
end
require 'spec_helper'
describe "Static pages" do
describe "Home page" do
it "should have the content 'Sample App'" do
visit '/static_pages/home'
page.should have_content('Sample App')
end
end
describe "Help page" do
it "should have the content 'Help'" do
visit '/static_pages/help'
page.should have_content('Help')
end
end
describe "About page" do
it "should have the content 'About Us'" do
visit '/static_pages/about'
page.should have_content('About Us')
end
end
end
从堆栈跟踪的第一行开始,看起来您明确地包含了垂直椭圆。我怀疑教程作者并不打算包含“…”——更多的意思是在三个静态页面路由和路由的结尾之间可能有额外的行。绘制块。谢谢,就是这样。我认为在早期的例子中,“…”是存在的,并且有效。
require 'spec_helper'
describe "Static pages" do
describe "Home page" do
it "should have the content 'Sample App'" do
visit '/static_pages/home'
page.should have_content('Sample App')
end
end
describe "Help page" do
it "should have the content 'Help'" do
visit '/static_pages/help'
page.should have_content('Help')
end
end
describe "About page" do
it "should have the content 'About Us'" do
visit '/static_pages/about'
page.should have_content('About Us')
end
end
end