Extract fetch-by-page from BPE to service

This commit is contained in:
Rohan Mitchell
2014-11-21 09:56:29 +11:00
parent 58fdc48b9f
commit 824b00743e
3 changed files with 32 additions and 7 deletions

View File

@@ -0,0 +1,13 @@
describe "PagedFetcher service", ->
PagedFetcher = null
beforeEach ->
module "ofn.admin"
beforeEach inject (_PagedFetcher_) ->
PagedFetcher = _PagedFetcher_
describe "substituting a page in the URL", ->
it "replaces ::page:: with the given page number", ->
expect(PagedFetcher.urlForPage("http://example.com/foo?page=::page::&per_page=20", 12)).
toEqual "http://example.com/foo?page=12&per_page=20"