Sha256: 4f9ae926285e7f423356902ada8026e77357501ac0dac0312a0e192d90ff8efa

Contents?: true

Size: 1.43 KB

Versions: 24

Compression:

Stored size: 1.43 KB

Contents

JSpec.include({
  name: 'Helpers',
  utilities : {
    mock_it : function(body) {
      JSpec.assert = false
      var spec = new JSpec.Spec('mock', body)
      var prev = JSpec.currentSpec
      JSpec.runSpec(spec)
      JSpec.currentSpec = prev
      JSpec.assert = true
      return spec
    }
  },
  
  matchers : {
    have_failure_message : function(spec, expected) {
      return JSpec.any(spec.assertions, function(assertion){
        if (assertion.passed) return
        switch (expected.constructor) {
          case String: return assertion.message == expected
          case RegExp: return expected.test(assertion.message)
          default    : return false
        }
      })
    }
  }
})

JSpec.include({
  name: 'ExampleModule',
  utilities : {
    doFoo : function(){ return 'foo' },
    doBar : function(){ return 'bar' }
  },
  randomHook : function(a, b) {
    return [a, b]
  },
  beforeSpec  : function() { addedBeforeSpec  = true; this.utilities.doFoo()  },
  afterSpec   : function() { addedAfterSpec   = true  },
  beforeSuite : function() { addedBeforeSuite = true  },
  afterSuite  : function() { addedAfterSuite  = true  },
  matchers : {
    be_foo_bar : function() {
      return true
    }
  },
  DSLs : {
    snake : {
      some_snake_case_stuff : function(){
        return true
      }
    },
    camel : {
      someCamelCaseStuff : function() {
        return true
      }
    }
  }
})

JSpec.include({
  name : 'EmptyModule'
})

Version data entries

24 entries across 24 versions & 4 rubygems

Version Path
gentooboontoo-jspec-4.3.3 spec/unit/helpers.js
bootcamp-0.1.4 vendor/test_suites/jspec/spec/unit/helpers.js
bootcamp-0.1.0 vendor/test_suites/jspec/spec/unit/helpers.js
jspec-4.3.3 spec/unit/helpers.js
jspec-4.3.2 spec/unit/helpers.js
jspec-steventux-3.3.2.1 spec/unit/helpers.js
jspec-steventux-3.3.2 spec/unit/helpers.js
jspec-4.3.1 spec/unit/helpers.js
jspec-4.3.0 spec/unit/helpers.js
jspec-4.2.1 spec/unit/helpers.js
jspec-4.2.0 spec/unit/helpers.js
jspec-4.1.0 spec/unit/helpers.js
jspec-4.0.0 spec/unit/helpers.js
jspec-3.3.3 spec/unit/helpers.js
jspec-3.3.2 spec/unit/helpers.js
jspec-3.3.1 spec/unit/helpers.js
jspec-3.3.0 spec/unit/helpers.js
jspec-3.2.1 spec/unit/helpers.js
jspec-3.2.0 spec/unit/helpers.js
jspec-3.1.3 spec/unit/helpers.js