Sha256: e1bf289fa58959202acdf8cb24ecb03423f22a9107c5f112cca67d3ef259e2b9

Contents?: true

Size: 1.45 KB

Versions: 4

Compression:

Stored size: 1.45 KB

Contents

beforeEach ->
  Joosy.Resource.Generic.resetIdentity()

  window.JST = {}
  $('body').append('<div id="ground">')

  @ground = $('body #ground')

  @seedGround = ->
    @ground.html('
      <div id="application" class="application">
        <div id="header" class="header" />
        <div id="wrapper" class="wrapper">
          <div id="content" class="content">
            <div id="post1" class="post" />
            <div id="post2" class="post" />
            <div id="post3" class="post" />
          </div>
          <div id="sidebar" class="sidebar">
            <div id="widget1" class="widget" />
            <div id="widget2" class="widget" />
          </div>
        </div>
        <div id="footer" class="footer" />
      </div>
    ')

  @addMatchers
    toBeSequenced: () ->
      if !Object.isArray(@actual) || @actual.length == 0
        console.log 'toBeSequenced: not array or empty array given'
        return false
      i = 0
      for spy in @actual
        unless spy.callCount == 1
          console.log "toBeSequenced: spy ##{i} was called #{spy.callCount} times"
          return false
        i++
      if @actual.length > 1
        for spy in @actual.from(1)
          i = @actual.indexOf spy
          previous = @actual[i - 1]
          unless spy.calledAfter previous
            console.log "toBeSequenced: spy ##{i} wasn't called after spy ##{i - 1}"
            return false
      return true

afterEach ->
  @ground.remove() unless @polluteGround

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
joosy-1.0.0.RC4 spec/javascripts/helpers/spec_helper.js.coffee
joosy-1.0.0.RC3 spec/javascripts/helpers/spec_helper.js.coffee
joosy-1.0.0.RC2 spec/javascripts/helpers/spec_helper.js.coffee
joosy-1.0.0.RC1 spec/javascripts/helpers/spec_helper.js.coffee