1
require 'spec_helper'
describe "Posts pages" do
  let!(:posts) { FactoryGirl.create_list(:post, 3) }
  subject { page }
  describe "Blog page" do
    context "Listing all posts" do
      before do
        visit "/blog"
      end
        it "should list all available posts" do
        posts.each do |post|
          page.should have_selector "h3 a", :text => post.title
          page.should have_selector ".content", :text => post.content
        end
      end
    end
  end
  describe "Showing a post" do
    let!(:post) { posts.last }
    before do
      visit "/blog"
      current_path.should == "/blog"
      click_link post.title
      save_and_open_page
    end

    it "should have post info" do
      should have_content post.title
      should have_content post.content
    end
  end
end

如果我删除click_link post.title我的代码工作正常。

我在用着capybara (2.1.0)

为什么,我的错误在哪里?

4

0 回答 0