silverstripe-framework/thirdparty/jquery-entwine/vendor/jspec/spec/helpers.js
Ingo Schommer 8256228e69 MINOR Upgraded jQuery.entwine (formerly known as jQuery.concrete) to the latest trunk
MINOR Updated jQuery.concrete references to point to the new "entwine" name

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@102695 467b73ca-7a2a-4603-9d3b-597d59a354a9
2010-04-13 05:45:29 +00:00

62 lines
1.4 KiB
JavaScript

JSpec.include({
name: 'Helpers',
utilities : {
mock_it : function(body) {
var spec = new JSpec.Spec('mock', body)
var prev = JSpec.currentSpec
JSpec.runSpec(spec)
JSpec.currentSpec = prev
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'
})