 routes = rewire '../routes'
 
 describe 'Sitemaps', ->
+
+  beforeEach ->
+    sinon.stub Backbone, 'sync'
+    @req = {}
+    @res =
+      render: sinon.stub()
+      set: sinon.stub()
+
+  afterEach ->
+    Backbone.sync.restore()
+
   describe '#robots', ->
     beforeEach ->
       @res = set: sinon.stub(), send: sinon.stub()

      routes.robots null, @res
      @res.send.args[0][0]
        .should.equal  'Sitemap: https://www.artsy.net/sitemap.xml'

  beforeEach ->
    sinon.stub Backbone, 'sync'
    @req = {}
    @res =
      render: sinon.stub()
      set: sinon.stub()

  afterEach ->
    Backbone.sync.restore()

  describe '#news_sitemap', ->


  describe '#artworks', ->

    it 'displays the correct artwork URLs in the sitemap', ->
      routes.__set__ 'request', get: -> query: -> end: (cb) ->
        cb(null, { body: results: [fabricate 'artwork', { id: 'foo'}] })
      @req = 
        params:
          date: '2012-01-01'
          page: 3
      routes.artworksPage('artworks')(@req, @res)
      @res.render.args[0][0].should.equal('artworks')
      @res.render.args[0][1].models[0].id.should.equal('foo')
