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