Permalink
Browse files

Added testing suite and some basic tests

  • Loading branch information...
1 parent bc34855 commit 742a285c71893d7b9d472e6f422b9f37e76a80a7 @pieterv pieterv committed Jan 6, 2012
@@ -0,0 +1,54 @@
+<!doctype html>
+<html lang="en">
+<head>
+ <meta charset="UTF-8">
+
+ <title>Jasmine Test Runner</title>
+
+ <!-- include Jasmine source files -->
+ <link rel="stylesheet" type="text/css" href="../libs/jasmine/jasmine.css">
+ <script type="text/javascript" src="../libs/jasmine/jasmine-1.1.0.js"></script>
+ <script type="text/javascript" src="../libs/jasmine/jasmine-html.js"></script>
+
+ <!-- include Sinon source files -->
+ <script type="text/javascript" src="../libs/sinon/sinon-1.2.0.js"></script>
+ <script type="text/javascript" src="../libs/jasmine-sinon.js"></script>
+
+ <!-- include source files here -->
+ <script src="../../src/libs/curl/src/curl.js"></script>
+ <script>
+ curl(
+ {
+ baseUrl: '../../src/',
+ pluginPath: 'curl/plugin',
+ //debug: true,
+ paths: {
+ curl: 'libs/curl/src/curl',
+ spec: '../spec/suits'
+ },
+ packages: [
+ { name: 'underscore', path: 'libs/underscore', main: 'underscore-min' },
+ { name: 'backbone', path: 'libs/backbone', main: 'backbone-optamd3-min' },
+ { name: 'jquery', path: 'libs/jquery', main: 'jquery-min' },
+ { name: 'when', path: 'libs/when', main: 'when' },
+ { name: 'wire', path: 'libs/wire', lib: 'wire', main: 'wire' },
+ { name: 'aop', path: 'libs/aop', main: 'aop' }
+ ]
+ }
+ ).next( [
+ 'spec/views/app',
+ 'spec/collections/todos'
+ ], function() {
+
+ // Run Jasmine
+ jasmine.getEnv().addReporter( new jasmine.TrivialReporter() );
+ jasmine.getEnv().execute();
+
+ } );
+ </script>
+
+</head>
+<body>
+
+</body>
+</html>
@@ -0,0 +1,41 @@
+(function(global) {
+
+ var spyMatchers = "called calledOnce calledTwice calledThrice calledBefore calledAfter calledOn alwaysCalledOn calledWith alwaysCalledWith calledWithExactly alwaysCalledWithExactly".split(" "),
+ i = spyMatchers.length,
+ spyMatcherHash = {},
+ unusualMatchers = {
+ "returned": "toHaveReturned",
+ "alwaysReturned": "toHaveAlwaysReturned"
+ },
+
+ getMatcherFunction = function(sinonName) {
+ return function() {
+ var sinonProperty = this.actual[sinonName];
+ return (typeof sinonProperty === 'function') ? sinonProperty.apply(this.actual, arguments) : sinonProperty;
+ };
+ };
+
+ while(i--) {
+ var sinonName = spyMatchers[i],
+ matcherName = "toHaveBeen" + sinonName.charAt(0).toUpperCase() + sinonName.slice(1);
+
+ spyMatcherHash[matcherName] = getMatcherFunction(sinonName);
+ };
+
+ for (var j in unusualMatchers) {
+ spyMatcherHash[unusualMatchers[j]] = getMatcherFunction(j);
+ }
+
+ global.sinonJasmine = {
+ getMatchers: function() {
+ return spyMatcherHash;
+ }
+ };
+
+})(window);
+
+beforeEach(function() {
+
+ this.addMatchers(sinonJasmine.getMatchers());
+
+});
@@ -0,0 +1,20 @@
+Copyright (c) 2008-2011 Pivotal Labs
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Oops, something went wrong.

0 comments on commit 742a285

Please sign in to comment.