Skip to content

Instantly share code, notes, and snippets.

@danielpetisme
Last active January 4, 2016 02:59
Show Gist options
  • Save danielpetisme/8558551 to your computer and use it in GitHub Desktop.
Save danielpetisme/8558551 to your computer and use it in GitHub Desktop.
Golosa Test elevator pitch

Golosa Test

The world didn’t need another tesing framework. So we built yet another one. A Golo one: Golosa Test

Golosa Test is a behavior-driven development framework for testing mainly inspired by Jasmine (a JS behavioral testing framework). Since a snippet is worth a thousand words:

module my.awesome.test

#The only import gather all the Golosa SA API
import golosa.test.$

#A test module must have a test method
function test = {

  #Define a Test suite with a description and an executable code block (ie. a lambda)
  describe("A test suite", {
    
    #A lambda can contain any executable code necessary, be careful with Golo   scoping rules
    var aList = null

    #Setting up the test fixture.
    beforeEach({
      aList = list[]
      aList: append("something")
    })

    #Defines a specification
    it("contains a specification with an expectation", {
      expect(aList: size()): toBe(1)
      expect(aList: isEmpty()): not(): toBeTrue()
    })

    #Disable a suite or a spec by prefixing it with 'x'
    xit("contains something", {
      expect("something"): toBeIn(aList)
    })

    #Tear down the test fixture to return to the original state.
    afterEach({
      aList = null
    })
  })
}

Do not trust this snippet, test by yourself! Go to Golosa Test project page and give it a try…

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment