1
我對Micheal Hartl教程第9章有所疑問。而且我試圖檢查用戶名是否顯示在頁面上。但我發現了這個錯誤使用rpsec時出現分頁錯誤
Failure/Error: User.paginate.(page:1).each do |user|
ArgumentError:
wrong number of arguments (0 for 1)
我可能得改變部分User.paginate.(page: 1).each do |user|
。但我必須做什麼?
這裏是rspect目錄內的代碼。
describe "index" do
let(:user) { FactoryGirl.create(:user) }
before do
sign_in user
30.times { FactoryGirl.create(:user) }
visit users_path
end
it { should have_selector('title', text: 'All users') }
it { should have_selector('h1', text: 'All users') }
it "should list each user" do
User.paginate.(page: 1).each do |user|
page.should have_selector('li>a', text: user.name)
end
end
end
你使用的是什麼版本的ruby? –
紅寶石1.9.3p286 – skip87
你的Gemfile中有will_paginate gem嗎? –