       expect(currentResultListener).toHaveBeenCalledWith(markers[1])
       currentResultListener.reset()
 
-      search.replace([markers[1]], "new-text")
+      model.replace([markers[1]], "new-text")
 
       expect(editor.getText()).toBe """
         -----------

    """

    findOptions = new FindOptions
    search = new BufferSearch(findOptions)

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

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

    search.setEditor(editor)
    markersListener.reset()

    search.setFindOptions(
      findPattern: "a+"
      caseSensitive: false
      useRegex: true
      wholeWord: false
    )

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

  getHighlightedRanges = ->

FindOptions = require '../lib/find-options'

describe "BufferSearch", ->
  [model, editor, markersListener, currentResultListener] = []

  beforeEach ->
    editor = new TextEditor
