       expect(@fixture.checkSpelling(frFR)).toEqual []
 
     it "correctly switches languages", ->
+      expect(@fixture.setDictionary('en_US', dictionaryDirectory)).toBe true
       expect(@fixture.checkSpelling(enUS)).toEqual []
       expect(@fixture.checkSpelling(deDE)).not.toEqual []
       expect(@fixture.checkSpelling(frFR)).not.toEqual []
 
-      if @fixture.setDictionary('de', dictionaryDirectory)
+      if @fixture.setDictionary('de_DE', dictionaryDirectory)
         expect(@fixture.checkSpelling(enUS)).not.toEqual []
         expect(@fixture.checkSpelling(deDE)).toEqual []
         expect(@fixture.checkSpelling(frFR)).not.toEqual []
 
       @fixture = new Spellchecker()
-      if @fixture.setDictionary('fr', dictionaryDirectory)
+      if @fixture.setDictionary('fr_FR', dictionaryDirectory)
         expect(@fixture.checkSpelling(enUS)).not.toEqual []
         expect(@fixture.checkSpelling(deDE)).not.toEqual []
         expect(@fixture.checkSpelling(frFR)).toEqual []

      @fixture.setDictionary defaultLanguage, dictionaryDirectory

    it "returns true if the word is mispelled", ->
      @fixture.setDictionary('en', dictionaryDirectory)
      expect(@fixture.isMisspelled('wwoorrddd')).toBe true

    it "returns false if the word isn't mispelled", ->
      @fixture.setDictionary('en', dictionaryDirectory)
      expect(@fixture.isMisspelled('word')).toBe false

    it "throws an exception when no word specified", ->

{Spellchecker} = require '../lib/spellchecker'
path = require 'path'

enUS = "A robot is a mechanical or virtual artificial agent, usually an electronic machine"
deDE = "Ein Roboter ist eine technische Apparatur, die üblicherweise dazu dient, dem Menschen mechanische Arbeit abzunehmen."
frFR = "Les robots les plus évolués sont capables de se déplacer et de se recharger par eux-mêmes"

defaultLanguage = if process.platform is 'darwin' then '' else 'en_US'
dictionaryDirectory = path.join(__dirname, 'dictionaries')

describe "SpellChecker", ->
