我在 Micheal Hartl 教程第 9 章上。我正在尝试检查用户名是否显示在页面上。但我收到了这个错误
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