         result.should.be.eql 'result'
 
       it 'calls the callback with a multiple value collection', ->
-        callback = sinon.stub().returns 'result'
+        callback = @fakes.stub().returns 'result'
         result = @giphy.getRandomResult [ 'testing1', 'testing2' ], callback
         callback.should.have.been.called.once
         callback.should.have.been.calledWith sinon.match('testing1').or sinon.match('testing2')

    describe '.getEndpoint', ->
      it 'passes state input to match function', ->
        state = { input: 'testing' }
        sinon.stub @giphy, 'match', ->
          null
        @giphy.getEndpoint state
        @giphy.match.should.be.called.once
        @giphy.match.should.be.calledWith state.input
        @giphy.match.restore()

      it 'handles null match result', ->
        state = {}
        sinon.stub @giphy, 'match', -> null
        @giphy.getEndpoint state
        @giphy.match.restore()
        state.endpoint.should.eql ''
        state.args.should.eql ''

      it 'handles endpoint and args match', ->
        state = {}
        sinon.stub @giphy, 'match', -> [ null, 'test1', 'test2' ]
        @giphy.getEndpoint state
        @giphy.match.restore()
        state.endpoint.should.eql 'test1'
        state.args.should.eql 'test2'

      it 'handles only args match', ->
        state = {}
        sinon.stub @giphy, 'match', -> [ null, null, 'test2' ]
        @giphy.getEndpoint state
        @giphy.match.restore()
        state.endpoint.should.eql @giphy.constructor.defaultEndpoint
        state.args.should.eql 'test2'



    describe '.getRandomResult', ->
      it 'calls the callback with a single value collection', ->
        callback = @fakes.stub().returns 'result'
        result = @giphy.getRandomResult [ 'testing' ], callback
        callback.should.have.been.called.once
        callback.should.have.been.calledWith 'testing'
