 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()

  describe '#artworks', ->

    it 'displays the correct artwork URLs in the sitemap', ->
      routes.artworksPage('artworks')(@req, @res)
      Backbone.sync.args[0][2].success {
        results: [
          fabricate('artwork', { id: 'foo' })
        ]
      }

      @res.render.args[0][0].should.equal('artworks')
      @res.render.args[0][1].artworks[0].id.should.equal('foo')
      routes.robots null, @res
      @res.send.args[0][0]
        .should.equal  'Sitemap: https://www.artsy.net/sitemap.xml'

  describe '#news_sitemap', ->

