 describe 'linter-registry', ->
   LinterRegistry = require('../lib/linter-registry')
   EditorLinter = require('../lib/editor-linter')
+  linterRegistry = null
   beforeEach ->
     waitsForPromise ->
       atom.workspace.destroyActivePaneItem()
       atom.workspace.open('test.txt')
-
-  describe '::construct', ->
-    it 'expects no arguments', ->
-      linterRegistry = new LinterRegistry
-      expect(true).toBe(true)
-      linterRegistry.deactivate()
+    linterRegistry?.deactivate()
+    linterRegistry = new LinterRegistry
 
   describe '::addLinter', ->
     it 'adds error notification if linter is invalid', ->
-      linterRegistry = new LinterRegistry
       linterRegistry.addLinter({})
-      linterRegistry.deactivate()
       expect(atom.notifications.getNotifications().length).toBe(1)
     it 'pushes linter into registry when valid', ->
       linter = {grammarScopes: ['*'], lintOnFly: false, modifiesBuffer: false, scope: 'file', lint: -> }
-      linterRegistry = new LinterRegistry
       linterRegistry.addLinter(linter)
       expect(linterRegistry.linters.length).toBe(1)
-      linterRegistry.deactivate()
 
   describe '::hasLinter', ->
     it 'returns true if present', ->
       linter = {grammarScopes: ['*'], lintOnFly: false, modifiesBuffer: false, scope: 'file', lint: -> }
-      linterRegistry = new LinterRegistry
       linterRegistry.addLinter(linter)
       expect(linterRegistry.hasLinter(linter)).toBe(true)
-      linterRegistry.deactivate()
     it 'returns false if not', ->
       linter = {grammarScopes: ['*'], lintOnFly: false, modifiesBuffer: false, scope: 'file', lint: -> }
-      linterRegistry = new LinterRegistry
       expect(linterRegistry.hasLinter(linter)).toBe(false)
-      linterRegistry.deactivate()
 
   describe '::deleteLinter', ->
     it 'deletes the linter from registry', ->
       linter = {grammarScopes: ['*'], lintOnFly: false, modifiesBuffer: false, scope: 'file', lint: -> }
-      linterRegistry = new LinterRegistry
       linterRegistry.addLinter(linter)
       expect(linterRegistry.hasLinter(linter)).toBe(true)
       linterRegistry.deleteLinter(linter)
       expect(linterRegistry.hasLinter(linter)).toBe(false)
-      linterRegistry.deactivate()
 
   describe '::lint', ->
     it "doesn't lint if textEditor isn't active one", ->
-      linterRegistry = new LinterRegistry
       editorLinter = new EditorLinter(atom.workspace.getActiveTextEditor())
       linter = {
         grammarScopes: ['*']

      waitsForPromise ->
        atom.workspace.open('someNonExistingFile.txt').then ->
          expect(linterRegistry.lint({onChange: false, editorLinter})).toBeUndefined()
          linterRegistry.deactivate()
    it 'disallows two co-current lints of same type', ->
      linterRegistry = new LinterRegistry
      editorLinter = new EditorLinter(atom.workspace.getActiveTextEditor())
      linter = {
        grammarScopes: ['*']

      linterRegistry.addLinter(linter)
      expect(linterRegistry.lint({onChange: false, editorLinter})).toBeDefined()
      expect(linterRegistry.lint({onChange: false, editorLinter})).toBeUndefined()

    describe 'buffer modifying linter', ->
      it 'triggers before other linters', ->
