lib/spree/api/testing_support/setup.rb in spree_api-1.3.5 vs lib/spree/api/testing_support/setup.rb in spree_api-2.0.0.rc1
- old
+ new
@@ -7,9 +7,22 @@
user = stub_model(Spree::LegacyUser)
user.should_receive(:has_spree_role?).any_number_of_times.with("admin").and_return(true)
user
end
end
+
+ # Default kaminari's pagination to a certain range
+ # Means that you don't need to create 25 objects to test pagination
+ def default_per_page(count)
+ before do
+ @current_default_per_page = Kaminari.config.default_per_page
+ Kaminari.config.default_per_page = 1
+ end
+
+ after do
+ Kaminari.config.default_per_page = @current_default_per_page
+ end
+ end
end
end
end
end