       it 'handles true then false result from getNextOption', ->
         state = { args: 'testing' }
         calls = 2
-        sinon.stub @giphy, 'getNextOption', (state) ->
-          (calls = calls - 1) > 0
+        sinon.stub @giphy, 'getNextOption', (state) -> (calls = calls - 1) > 0
         @giphy.getOptions state
         @giphy.getNextOption.should.be.called.twice
         @giphy.getNextOption.should.be.calledWith state


      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

      @giphy.constructor.defaultEndpoint.should.have.length.above 0

    describe '.error', ->
      beforeEach ->
        sinon.stub @giphy, 'sendMessage'

      afterEach ->
        @giphy.sendMessage.restore()

      it 'sends the reason if msg and reason exist', ->
        @giphy.error @msg, 'test'
        @giphy.sendMessage.should.have.been.called.once
        @giphy.sendMessage.should.have.been.calledWith @msg, 'test'

      it 'ignores a null msg or reason', ->
        @giphy.error()
        @giphy.error @msg
        @giphy.error @msg, null
        @giphy.error null, 'test'
        @giphy.sendMessage.should.not.have.been.called

    describe '.createState', ->
      it 'returns a valid state instance', ->
