小编Mar*_*nka的帖子

Rspec测试应该通过但是失败

我从迈克尔哈特尔书中得到了这个测试:

require 'spec_helper'
  describe "Static pages" do
    let(:base_title) { "Ruby on Rails Tutorial Sample App" }

    describe "Home page" do
      it "should have the h1 'Sample App'" do
        visit '/static_pages/home'
        page.should have_selector('h1', :text => 'Sample App')
      end

      it "should have the title 'Home'" do
        visit '/static_pages/home'
        page.should have_selector('title', :text => "#{base_title} | Home")
      end
  end
end
Run Code Online (Sandbox Code Playgroud)

并且观点:

<% provide(:title, 'Home') %>
<h1>Sample App</h1>
<p>
  This is the home page for the
  <a href="http://railstutorial.org/">Ruby on Rails Tutorial</a>
  sample application. …
Run Code Online (Sandbox Code Playgroud)

rspec ruby-on-rails erb capybara railstutorial.org

3
推荐指数
1
解决办法
1560
查看次数

标签 统计

capybara ×1

erb ×1

railstutorial.org ×1

rspec ×1

ruby-on-rails ×1