Created
May 18, 2013 20:42
-
-
Save netzfisch/5605721 to your computer and use it in GitHub Desktop.
failing example of testing will_paginate with a stub
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'will_paginate/array' | |
describe "recurrences/index" do | |
let(:recurrences) do [ | |
FactoryGirl.build(:recurrence, scheduled_to: "2012-07-05"), | |
FactoryGirl.build(:recurrence, scheduled_to: "2012-07-12"), | |
FactoryGirl.build(:recurrence, scheduled_to: "2012-07-19") | |
] | |
end | |
it "should have a pagination bar" do | |
assign(:recurrences, recurrences) | |
Recurrence.stub(:paginate).with(page: "1").and_return(recurrences.paginate(per_page: 2)) | |
render | |
expect(rendered).to have_selector('div.pagination') | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
But this leads to an error: