       expect(editor.getText()).toBe ''
 
     it 'does not change spaces at the end of a line', ->
-      buffer.setText('foobarbaz     ')
+      editor.setText('foobarbaz     ')
       TabsToSpaces.tabify(editor)
       expect(editor.getText()).toBe 'foobarbaz     '
 
     it 'does not change spaces in the middle of a line', ->
-      buffer.setText('foo  bar  baz')
+      editor.setText('foo  bar  baz')
       TabsToSpaces.tabify(editor)
       expect(editor.getText()).toBe 'foo  bar  baz'
 
     it 'converts one tab worth of spaces to a tab', ->
       editor.setTabLength(2)
-      buffer.setText('  foo')
+      editor.setText('  foo')
       TabsToSpaces.tabify(editor)
       expect(editor.getText()).toBe '\tfoo'
 
     it 'converts almost two tabs worth of spaces to one tab and some spaces', ->
       editor.setTabLength(4)
-      buffer.setText('       foo')
+      editor.setText('       foo')
       TabsToSpaces.tabify(editor)
       expect(editor.getText()).toBe '\t   foo'
 
     it 'changes multiple lines of leading spaces to tabs', ->
       editor.setTabLength(4)
-      buffer.setText('    foo\n       bar')
+      editor.setText('    foo\n       bar')
       TabsToSpaces.tabify(editor)
       expect(editor.getText()).toBe '\tfoo\n\t   bar'
 
     it 'leaves successive newlines alone', ->
       editor.setTabLength(2)
-      buffer.setText('  foo\n\n  bar\n\n  baz\n\n')
+      editor.setText('  foo\n\n  bar\n\n  baz\n\n')
       TabsToSpaces.tabify(editor)
       expect(editor.getText()).toBe '\tfoo\n\n\tbar\n\n\tbaz\n\n'
 
     it 'changes mixed spaces and tabs to uniform whitespace', ->
       editor.setTabLength(2)
-      buffer.setText('\t \tfoo\n')
+      editor.setText('\t \tfoo\n')
       TabsToSpaces.tabify(editor)
       expect(editor.getText()).toBe '\t\t foo\n'
 


    it 'will untabify before an editor saves a buffer', ->
      atom.config.set('tabs-to-spaces.onSave', 'untabify')
      buffer.setText('\t\tfoo\n\t\tbar\n\n')
      editor.save()
      expect(editor.getText()).toBe '        foo\n        bar\n\n'

    it 'will tabify before an editor saves a buffer', ->
      atom.config.set('tabs-to-spaces.onSave', 'tabify')
      buffer.setText('        foo\n        bar\n\n')
      editor.save()
      expect(editor.getText()).toBe '\t\tfoo\n\t\tbar\n\n'


        spyOn(atom.config, 'getUserConfigPath').andReturn(filePath)
        spyOn(editor, 'getPath').andReturn(filePath)

        editor.setText('    foo\n    bar\n\n')
        editor.save()
        expect(editor.getText()).toBe '    foo\n    bar\n\n'
