 FindOptions = require '../lib/find-options'
 
 describe "BufferSearch", ->
-  [search, editor, markersListener, currentResultListener] = []
+  [model, editor, markersListener, currentResultListener] = []
 
   beforeEach ->
     editor = new TextEditor

      expect(currentResultListener).toHaveBeenCalledWith(markers[1])
      currentResultListener.reset()

      search.replace([markers[1]], "new-text")

      expect(editor.getText()).toBe """
        -----------

    """

    findOptions = new FindOptions
    model = new BufferSearch(findOptions)

    markersListener = jasmine.createSpy('markersListener')
    model.onDidUpdate(markersListener)

    currentResultListener = jasmine.createSpy('currentResultListener')
    model.onDidChangeCurrentResult(currentResultListener)

    model.setEditor(editor)
    markersListener.reset()

    model.search "a+",
      caseSensitive: false
      useRegex: true
      wholeWord: false

  afterEach ->
    model.destroy()
    editor.destroy()

  getHighlightedRanges = ->
