require '../spec_helper'

describe "Freakset Acceptance", ->
  
  beforeEach ->
    @freakset = new Freakset()
    @set = null

  # Nested steps will be attached directly after the current step.
  it "should compile a Step-In-Step Freakset", ->

    @freakset.step "step1", (set) ->
      set.store['steps'].push("step1")
      
      set.step "step1:inner-step2", (set) ->
        set.store['steps'].push("inner-step2")
        
        set.step "step1:inner-step2:inner-inner-step3", ->
          set.store['steps'].push("inner-inner-step3")
          set.commit()
        
        set.commit()
      
      set.commit()
      
    
    @set = @freakset.compile { steps: [] }
    

    waitsFor -> !@set.isRunning()
    
    runs ->
      expect(@set.store['steps']).toContain("step1")
      expect(@set.store['steps']).toContain("inner-step2")
      expect(@set.store['steps']).toContain("inner-inner-step3")