unittests/sinon-qunit.js
branchnew-model
changeset 924 64c2eaafe5e2
parent 923 b3ee7d1b472a
child 925 28efc97b5d78
equal deleted inserted replaced
923:b3ee7d1b472a 924:64c2eaafe5e2
     1 /**
       
     2  * sinon-qunit 1.0.0, 2010/12/09
       
     3  *
       
     4  * @author Christian Johansen (christian@cjohansen.no)
       
     5  *
       
     6  * (The BSD License)
       
     7  * 
       
     8  * Copyright (c) 2010-2011, Christian Johansen, christian@cjohansen.no
       
     9  * All rights reserved.
       
    10  * 
       
    11  * Redistribution and use in source and binary forms, with or without modification,
       
    12  * are permitted provided that the following conditions are met:
       
    13  * 
       
    14  *     * Redistributions of source code must retain the above copyright notice,
       
    15  *       this list of conditions and the following disclaimer.
       
    16  *     * Redistributions in binary form must reproduce the above copyright notice,
       
    17  *       this list of conditions and the following disclaimer in the documentation
       
    18  *       and/or other materials provided with the distribution.
       
    19  *     * Neither the name of Christian Johansen nor the names of his contributors
       
    20  *       may be used to endorse or promote products derived from this software
       
    21  *       without specific prior written permission.
       
    22  * 
       
    23  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
       
    24  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
       
    25  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
       
    26  * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
       
    27  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
       
    28  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
       
    29  * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
       
    30  * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
       
    31  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
       
    32  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
       
    33  */
       
    34 /*global sinon, QUnit, test*/
       
    35 sinon.assert.fail = function (msg) {
       
    36     QUnit.ok(false, msg);
       
    37 };
       
    38 
       
    39 sinon.assert.pass = function (assertion) {
       
    40     QUnit.ok(true, assertion);
       
    41 };
       
    42 
       
    43 sinon.config = {
       
    44     injectIntoThis: true,
       
    45     injectInto: null,
       
    46     properties: ["spy", "stub", "mock", "clock", "sandbox"],
       
    47     useFakeTimers: true,
       
    48     useFakeServer: false
       
    49 };
       
    50 
       
    51 (function (global) {
       
    52     var qTest = QUnit.test;
       
    53     
       
    54     QUnit.test = global.test = function (testName, expected, callback, async) {
       
    55         if (arguments.length === 2) {
       
    56             callback = expected;
       
    57             expected = null;
       
    58         }
       
    59 
       
    60         return qTest(testName, expected, sinon.test(callback), async);
       
    61     };
       
    62 }(this));