失败/错误:click_link post.title ArgumentError:错误的参数数量(1表示0)Rspec&水豚

时间:2013-04-23 10:08:39

标签: ruby-on-rails ruby-on-rails-3 rspec capybara bdd

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)

为什么,我在哪里出错?

0 个答案:

没有答案