shuriken 0.1.2.2 → 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (86) hide show
  1. data/.gitignore +1 -0
  2. data/Rakefile +28 -0
  3. data/coffeescripts/shuriken/test/assertions.coffee +111 -0
  4. data/coffeescripts/shuriken/test/reporters.coffee +61 -0
  5. data/coffeescripts/shuriken/test.coffee +117 -0
  6. data/coffeescripts/shuriken.coffee +2 -2
  7. data/javascripts/shuriken/mixins/callbacks.js +45 -0
  8. data/javascripts/shuriken/mixins.js +58 -0
  9. data/javascripts/shuriken/test/assertions.js +117 -0
  10. data/javascripts/shuriken/test/reporters.js +84 -0
  11. data/javascripts/shuriken/test.js +165 -0
  12. data/javascripts/shuriken.js +195 -0
  13. data/lib/shuriken.rb +1 -1
  14. data/shuriken.gemspec +84 -4
  15. data/tests/basic_namespace_tests.coffee +114 -0
  16. data/tests/template.erb +26 -0
  17. data/tests.watchr +6 -0
  18. data/vendor/jasmine-0.10.0/MIT.LICENSE +20 -0
  19. data/vendor/jasmine-0.10.0/README.markdown +437 -0
  20. data/vendor/jasmine-0.10.0/doc/files.html +460 -0
  21. data/vendor/jasmine-0.10.0/doc/index.html +322 -0
  22. data/vendor/jasmine-0.10.0/doc/symbols/_global_.html +918 -0
  23. data/vendor/jasmine-0.10.0/doc/symbols/jasmine.Block.html +417 -0
  24. data/vendor/jasmine-0.10.0/doc/symbols/jasmine.Clock.html +678 -0
  25. data/vendor/jasmine-0.10.0/doc/symbols/jasmine.Env.html +1169 -0
  26. data/vendor/jasmine-0.10.0/doc/symbols/jasmine.JsApiReporter.html +822 -0
  27. data/vendor/jasmine-0.10.0/doc/symbols/jasmine.Matchers.html +1461 -0
  28. data/vendor/jasmine-0.10.0/doc/symbols/jasmine.MultiReporter.html +394 -0
  29. data/vendor/jasmine-0.10.0/doc/symbols/jasmine.NestedResults.html +710 -0
  30. data/vendor/jasmine-0.10.0/doc/symbols/jasmine.Reporter.html +574 -0
  31. data/vendor/jasmine-0.10.0/doc/symbols/jasmine.Runner.html +710 -0
  32. data/vendor/jasmine-0.10.0/doc/symbols/jasmine.Spec.html +1259 -0
  33. data/vendor/jasmine-0.10.0/doc/symbols/jasmine.Spy.html +855 -0
  34. data/vendor/jasmine-0.10.0/doc/symbols/jasmine.Suite.html +705 -0
  35. data/vendor/jasmine-0.10.0/doc/symbols/jasmine.html +1345 -0
  36. data/vendor/jasmine-0.10.0/doc/symbols/jasmine.util.html +535 -0
  37. data/vendor/jasmine-0.10.0/doc/symbols/src/lib_TrivialReporter.js.html +124 -0
  38. data/vendor/jasmine-0.10.0/doc/symbols/src/src_Block.js.html +29 -0
  39. data/vendor/jasmine-0.10.0/doc/symbols/src/src_Env.js.html +240 -0
  40. data/vendor/jasmine-0.10.0/doc/symbols/src/src_JsApiReporter.js.html +111 -0
  41. data/vendor/jasmine-0.10.0/doc/symbols/src/src_Matchers.js.html +328 -0
  42. data/vendor/jasmine-0.10.0/doc/symbols/src/src_MultiReporter.js.html +36 -0
  43. data/vendor/jasmine-0.10.0/doc/symbols/src/src_NestedResults.js.html +88 -0
  44. data/vendor/jasmine-0.10.0/doc/symbols/src/src_PrettyPrinter.js.html +130 -0
  45. data/vendor/jasmine-0.10.0/doc/symbols/src/src_Queue.js.html +102 -0
  46. data/vendor/jasmine-0.10.0/doc/symbols/src/src_Reporter.js.html +35 -0
  47. data/vendor/jasmine-0.10.0/doc/symbols/src/src_Reporters.js.html +51 -0
  48. data/vendor/jasmine-0.10.0/doc/symbols/src/src_Runner.js.html +75 -0
  49. data/vendor/jasmine-0.10.0/doc/symbols/src/src_Spec.js.html +211 -0
  50. data/vendor/jasmine-0.10.0/doc/symbols/src/src_Suite.js.html +77 -0
  51. data/vendor/jasmine-0.10.0/doc/symbols/src/src_WaitsBlock.js.html +21 -0
  52. data/vendor/jasmine-0.10.0/doc/symbols/src/src_WaitsForBlock.js.html +45 -0
  53. data/vendor/jasmine-0.10.0/doc/symbols/src/src_base.js.html +555 -0
  54. data/vendor/jasmine-0.10.0/doc/symbols/src/src_mock-timeout.js.html +185 -0
  55. data/vendor/jasmine-0.10.0/doc/symbols/src/src_util.js.html +75 -0
  56. data/vendor/jasmine-0.10.0/example/example_runner.html +25 -0
  57. data/vendor/jasmine-0.10.0/example/spec/example_suite.js +11 -0
  58. data/vendor/jasmine-0.10.0/lib/TrivialReporter.js +117 -0
  59. data/vendor/jasmine-0.10.0/lib/consolex.js +28 -0
  60. data/vendor/jasmine-0.10.0/lib/jasmine-0.10.0.js +2261 -0
  61. data/vendor/jasmine-0.10.0/lib/jasmine.css +86 -0
  62. data/vendor/jasmine-0.10.0/spec/runner.html +63 -0
  63. data/vendor/jasmine-0.10.0/spec/suites/CustomMatchersSpec.js +112 -0
  64. data/vendor/jasmine-0.10.0/spec/suites/EnvSpec.js +71 -0
  65. data/vendor/jasmine-0.10.0/spec/suites/ExceptionsSpec.js +107 -0
  66. data/vendor/jasmine-0.10.0/spec/suites/JsApiReporterSpec.js +82 -0
  67. data/vendor/jasmine-0.10.0/spec/suites/MatchersSpec.js +589 -0
  68. data/vendor/jasmine-0.10.0/spec/suites/MockClockSpec.js +34 -0
  69. data/vendor/jasmine-0.10.0/spec/suites/MultiReporterSpec.js +30 -0
  70. data/vendor/jasmine-0.10.0/spec/suites/NestedResultsSpec.js +54 -0
  71. data/vendor/jasmine-0.10.0/spec/suites/PrettyPrintSpec.js +93 -0
  72. data/vendor/jasmine-0.10.0/spec/suites/QueueSpec.js +23 -0
  73. data/vendor/jasmine-0.10.0/spec/suites/ReporterSpec.js +60 -0
  74. data/vendor/jasmine-0.10.0/spec/suites/RunnerSpec.js +258 -0
  75. data/vendor/jasmine-0.10.0/spec/suites/SpecRunningSpec.js +1086 -0
  76. data/vendor/jasmine-0.10.0/spec/suites/SpecSpec.js +110 -0
  77. data/vendor/jasmine-0.10.0/spec/suites/SpySpec.js +187 -0
  78. data/vendor/jasmine-0.10.0/spec/suites/SuiteSpec.js +101 -0
  79. data/vendor/jasmine-0.10.0/spec/suites/TrivialReporterSpec.js +140 -0
  80. data/vendor/jasmine-0.10.0/spec/suites/UtilSpec.js +23 -0
  81. data/vendor/jquery.js +154 -0
  82. data/wip-coffeescripts/example_test.coffee +0 -0
  83. data/wip-coffeescripts/test/assertions.coffee +111 -0
  84. data/wip-coffeescripts/test/reporters.coffee +61 -0
  85. data/wip-coffeescripts/test.coffee +96 -15
  86. metadata +83 -4
@@ -0,0 +1,165 @@
1
+ Shuriken.Test = {
2
+ currentContext: []
3
+ };
4
+ Shuriken.withObject = function withObject(object, block) {
5
+ return with(object) { block.apply(object); };
6
+ };
7
+ (function(test) {
8
+ test.ContextResult = function ContextResult(context, results) {
9
+ this.context = context;
10
+ this.results = results;
11
+ return this;
12
+ };
13
+ test.TestResult = function TestResult(test, assertions) {
14
+ this.test = test;
15
+ this.assertions = assertions;
16
+ return this;
17
+ };
18
+ test.Context = function Context(name, context) {
19
+ this.name = name;
20
+ this.blocks = {};
21
+ this.context = context;
22
+ return this;
23
+ };
24
+ test.Context.prototype.blocksFor = function blocksFor(name) {
25
+ var _a;
26
+ return this.blocks[name] = (typeof (_a = this.blocks[name]) !== "undefined" && _a !== null) ? this.blocks[name] : [];
27
+ };
28
+ test.Context.prototype.addBlockFor = function addBlockFor(name, block) {
29
+ return this.blocksFor(name).push(block);
30
+ };
31
+ test.Context.prototype.run = function run() {
32
+ var _a, _b, results, scope;
33
+ scope = this.toScope();
34
+ if ((typeof (_a = this.context) !== "undefined" && _a !== null)) {
35
+ this.context.invokeBlocksFor("setupAll", scope);
36
+ }
37
+ this.invokeBlocksFor("setupAll", scope);
38
+ // Invoke all stuff.
39
+ results = [];
40
+ Shuriken.withObject(this, function() {
41
+ results = this.invokeBlocksFor("inner", scope);
42
+ return results;
43
+ });
44
+ this.invokeBlocksFor("teardownAll", scope);
45
+ if ((typeof (_b = this.context) !== "undefined" && _b !== null)) {
46
+ this.context.invokeBlocksFor("teardownAll", scope);
47
+ }
48
+ return new test.ContextResult(this, results);
49
+ };
50
+ test.Context.prototype.toScope = function toScope() {
51
+ var _a, _b, scope, self;
52
+ if ((typeof (_a = this.scope) !== "undefined" && _a !== null)) {
53
+ return this.scope;
54
+ }
55
+ scope = function scope() { };
56
+ if ((typeof (_b = this.context) !== "undefined" && _b !== null)) {
57
+ scope.prototype = this.context.toScope();
58
+ }
59
+ self = this;
60
+ this.scope = new scope();
61
+ this.scope.setup = function setup() {
62
+ var superSetup;
63
+ superSetup = scope.prototype.setup;
64
+ if ((typeof superSetup !== "undefined" && superSetup !== null)) {
65
+ superSetup.apply(this);
66
+ }
67
+ return self.invokeBlocksFor("setup", this);
68
+ };
69
+ this.scope.teardown = function teardown() {
70
+ var superSetup;
71
+ superSetup = scope.prototype.teardown;
72
+ if ((typeof superTeardown !== "undefined" && superTeardown !== null)) {
73
+ superSetup.apply(this);
74
+ }
75
+ return self.invokeBlocksFor("teardown", this);
76
+ };
77
+ return this.scope.teardown;
78
+ };
79
+ test.Context.prototype.invokeBlocksFor = function invokeBlocksFor(blockName, scope) {
80
+ var _a, _b, _c, _d, block;
81
+ _a = []; _c = this.blocksFor(blockNmae);
82
+ for (_b = 0, _d = _c.length; _b < _d; _b++) {
83
+ block = _c[_b];
84
+ _a.push(block.apply(scope));
85
+ }
86
+ return _a;
87
+ };
88
+ test.Context.prototype.setup = function setup(c) {
89
+ return this.addBlockFor("setup", c);
90
+ };
91
+ test.Context.prototype.teardown = function teardown(c) {
92
+ return this.addBlockFor("teardown", c);
93
+ };
94
+ test.Context.prototype.setupAll = function setupAll(c) {
95
+ return this.addBlockFor("setupAll", c);
96
+ };
97
+ test.Context.prototype.teardownAll = function teardownAll(c) {
98
+ return this.addBlockFor("teardownAll", c);
99
+ };
100
+ test.Context.prototype.context = function context(name, block) {
101
+ var context;
102
+ context = new test.Context(name, this);
103
+ block.apply(context);
104
+ return addBlockFor('inner', function() {
105
+ return context.run;
106
+ });
107
+ };
108
+ test.Context.prototype.should = function should(name, block) {
109
+ test = new test.Test(name, block, this);
110
+ return addBlockFor('inner', function() {
111
+ return test.run;
112
+ });
113
+ };
114
+ test.Test = function Test(name, body, context) {
115
+ this.name = name;
116
+ this.body = body;
117
+ this.context = context;
118
+ return this;
119
+ };
120
+ test.Test.prototype.run = function run() {
121
+ var result, scope;
122
+ scope = this.toScope();
123
+ scope.setup();
124
+ result = Shuriken.Test.catchingAssertions(function() {
125
+ return this.body.apply(scope);
126
+ });
127
+ scope.teardown();
128
+ return new test.TestResult(this, result);
129
+ };
130
+ test.Test.prototype.toScope = function toScope() {
131
+ var scope;
132
+ scope = function scope() { };
133
+ scope.prototype = this.context;
134
+ scope = new scope();
135
+ return scope;
136
+ };
137
+ test.displayResults = function displayResults(results) { };
138
+ // Do nothing at the moment...
139
+ test.testsFor = function testsFor(name, block) {
140
+ var context;
141
+ context = new test.Context(name);
142
+ test.tests[name] = context;
143
+ Shuriken.withObject(context, block);
144
+ context.runSuite = function runSuite() {
145
+ var results;
146
+ results = this.run();
147
+ return test.displayResults(results);
148
+ };
149
+ return context.runSuite;
150
+ };
151
+ test.tests = {};
152
+ test.runAll = function runAll() {
153
+ var _a, _b, _c, _d, _e, results;
154
+ results = (function() {
155
+ _a = []; _c = test.tests;
156
+ for (_b = 0, _d = _c.length; _b < _d; _b++) {
157
+ test = _c[_b];
158
+ (typeof (_e = test.runSuite) !== "undefined" && _e !== null) ? _a.push(test.run()) : null;
159
+ }
160
+ return _a;
161
+ })();
162
+ return test.displayResults(results);
163
+ };
164
+ return test;
165
+ })(Shuriken.Test);
@@ -0,0 +1,195 @@
1
+ var __slice = Array.prototype.slice, __bind = function(func, obj, args) {
2
+ return function() {
3
+ return func.apply(obj || {}, args ? args.concat(__slice.call(arguments, 0)) : arguments);
4
+ };
5
+ };
6
+ (function() {
7
+ var Shuriken, base, makeNS, scopedClosure;
8
+ // First off, add our dataAttr extensions.
9
+ (typeof jQuery !== "undefined" && jQuery !== null) ? (function($) {
10
+ var stringToDataKey;
11
+ stringToDataKey = function stringToDataKey(key) {
12
+ return ("data-" + key).replace(/_/g, '-');
13
+ };
14
+ $.fn.dataAttr = function dataAttr(key, value) {
15
+ return this.attr(stringToDataKey(key), value);
16
+ };
17
+ $.fn.removeDataAttr = function removeDataAttr(key) {
18
+ return this.removeAttr(stringToDataKey(key));
19
+ };
20
+ $.fn.hasDataAttr = function hasDataAttr(key) {
21
+ return this.is(("[" + (stringToDataKey(key)) + "]"));
22
+ };
23
+ $.metaAttr = function metaAttr(key) {
24
+ return $(("meta[name='" + key + "']")).attr("content");
25
+ };
26
+ return $.metaAttr;
27
+ })(jQuery) : null;
28
+ Shuriken = {
29
+ Base: {},
30
+ Util: {},
31
+ jsPathPrefix: "/javascripts/",
32
+ jsPathSuffix: "",
33
+ namespaces: {},
34
+ extensions: []
35
+ };
36
+ Shuriken.Util.underscoreize = function underscoreize(s) {
37
+ return s.replace(/\./g, '/').replace(/([A-Z]+)([A-Z][a-z])/g, '$1_$2').replace(/([a-z\d])([A-Z])/g, '$1_$2').replace(/-/g, '_').toLowerCase();
38
+ };
39
+ scopedClosure = function scopedClosure(closure, scope) {
40
+ if ($.isFunction(closure)) {
41
+ return closure.call(scope, scope);
42
+ }
43
+ };
44
+ // Base is the prototype for all namespaces.
45
+ base = Shuriken.Base;
46
+ base.hasChildNamespace = function hasChildNamespace(child) {
47
+ return this.children.push(child);
48
+ };
49
+ base.toNSName = function toNSName() {
50
+ var children, current, parts;
51
+ children = __slice.call(arguments, 0, arguments.length - 0);
52
+ parts = children;
53
+ current = this;
54
+ while ((typeof current !== "undefined" && current !== null)) {
55
+ parts.unshift(current.name);
56
+ current = current.parent;
57
+ }
58
+ return parts.join(".");
59
+ };
60
+ base.getNS = function getNS(namespace) {
61
+ var _a, _b, _c, _d, currentNS, name, parts;
62
+ parts = namespace.split(".");
63
+ currentNS = this;
64
+ _b = parts;
65
+ for (_a = 0, _c = _b.length; _a < _c; _a++) {
66
+ name = _b[_a];
67
+ if (!((typeof (_d = currentNS[name]) !== "undefined" && _d !== null))) {
68
+ return null;
69
+ }
70
+ currentNS = currentNS[name];
71
+ }
72
+ return currentNS;
73
+ };
74
+ base.getRootNS = function getRootNS() {
75
+ var _a, current;
76
+ current = this;
77
+ while ((typeof (_a = current.parent) !== "undefined" && _a !== null)) {
78
+ current = current.parent;
79
+ }
80
+ return current;
81
+ };
82
+ base.hasNS = function hasNS(namespace) {
83
+ var _a;
84
+ return (typeof (_a = this.getNS(namespace)) !== "undefined" && _a !== null);
85
+ };
86
+ base.withNS = function withNS(key, initializer) {
87
+ var _a, _b, _c, _d, currentNS, hadSetup, name, parts;
88
+ parts = key.split(".");
89
+ currentNS = this;
90
+ _b = parts;
91
+ for (_a = 0, _c = _b.length; _a < _c; _a++) {
92
+ name = _b[_a];
93
+ if (!(typeof (_d = currentNS[name]) !== "undefined" && _d !== null)) {
94
+ currentNS[name] = makeNS(name, currentNS, this.baseNS);
95
+ }
96
+ currentNS = currentNS[name];
97
+ }
98
+ hadSetup = $.isFunction(currentNS.setup);
99
+ scopedClosure(initializer, currentNS);
100
+ if (!hadSetup && $.isFunction(currentNS.setup)) {
101
+ currentNS.setupVia(currentNS.setup);
102
+ }
103
+ return currentNS;
104
+ };
105
+ base.withBase = function withBase(closure) {
106
+ return scopedClosure(closure, this.baseNS);
107
+ };
108
+ base.extend = function extend(closure) {
109
+ return scopedClosure(closure, this);
110
+ };
111
+ base.isRoot = function isRoot() {
112
+ var _a;
113
+ return !(typeof (_a = this.parent) !== "undefined" && _a !== null);
114
+ };
115
+ base.log = function log() {
116
+ var args;
117
+ args = __slice.call(arguments, 0, arguments.length - 0);
118
+ return console.log.apply(console, [("[" + (this.toNSName()) + "]")].concat(args));
119
+ };
120
+ base.debug = function debug() {
121
+ var args;
122
+ args = __slice.call(arguments, 0, arguments.length - 0);
123
+ return console.log.apply(console, [("[Debug - " + (this.toNSName()) + "]")].concat(args));
124
+ };
125
+ base.setupVia = function setupVia(f) {
126
+ return $(document).ready(__bind(function() {
127
+ var _a;
128
+ if ((typeof (_a = this.autosetup) !== "undefined" && _a !== null)) {
129
+ return scopedClosure(f, this);
130
+ }
131
+ }, this));
132
+ };
133
+ base.require = function require(key, callback) {
134
+ var ns, path, script, url;
135
+ ns = this.getNS(key);
136
+ if ((typeof ns !== "undefined" && ns !== null)) {
137
+ return scopedClosure(callback, ns);
138
+ } else {
139
+ path = Shuriken.Util.underscoreize(("" + (this.toNSName()) + "." + key));
140
+ url = ("" + (Shuriken.jsPathPrefix) + (path) + ".js" + (Shuriken.jsPathSuffix));
141
+ script = $("<script />", {
142
+ type: "text/javascript",
143
+ src: url
144
+ });
145
+ script.load(function() {
146
+ return scopedClosure(callback, this.getNS(key));
147
+ });
148
+ return script.appendTo($("head"));
149
+ }
150
+ };
151
+ base.autosetup = true;
152
+ // Used as a part of the prototype chain.
153
+ Shuriken.Namespace = function Namespace() { };
154
+ Shuriken.Namespace.prototype = Shuriken.Base;
155
+ makeNS = function makeNS(name, parent, sharedPrototype) {
156
+ var namespace;
157
+ sharedPrototype = (typeof sharedPrototype !== "undefined" && sharedPrototype !== null) ? sharedPrototype : new Shuriken.Namespace();
158
+ namespace = function namespace() {
159
+ this.name = name;
160
+ this.parent = parent;
161
+ this.baseNS = sharedPrototype;
162
+ this.children = [];
163
+ if ((typeof parent !== "undefined" && parent !== null)) {
164
+ parent.hasChildNamespace(this);
165
+ }
166
+ return this;
167
+ };
168
+ namespace.prototype = sharedPrototype;
169
+ return new namespace(name, parent);
170
+ };
171
+ Shuriken.defineExtension = function defineExtension(closure) {
172
+ var _a, _b, _c, namespace;
173
+ _b = Shuriken.namespaces;
174
+ for (_a = 0, _c = _b.length; _a < _c; _a++) {
175
+ namespace = _b[_a];
176
+ scopedClosure(closure, namespace);
177
+ }
178
+ return Shuriken.extensions.push(closure);
179
+ };
180
+ Shuriken.as = function as(name) {
181
+ var _a, _b, _c, extension, ns;
182
+ ns = makeNS(name);
183
+ Shuriken.namespaces[name] = ns;
184
+ Shuriken.root[name] = ns;
185
+ _b = Shuriken.extensions;
186
+ for (_a = 0, _c = _b.length; _a < _c; _a++) {
187
+ extension = _b[_a];
188
+ scopedClosure(extension, ns);
189
+ }
190
+ return ns;
191
+ };
192
+ Shuriken.root = this;
193
+ this['Shuriken'] = Shuriken;
194
+ return this['Shuriken'];
195
+ })();
data/lib/shuriken.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  module Shuriken
2
2
 
3
- VERSION = "0.1.2.2".freeze
3
+ VERSION = "0.1.3".freeze
4
4
 
5
5
  def self.register_framework!
6
6
  Barista::Framework.register 'shuriken', File.expand_path('../coffeescripts', File.dirname(__FILE__))
data/shuriken.gemspec CHANGED
@@ -5,25 +5,105 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{shuriken}
8
- s.version = "0.1.2.2"
8
+ s.version = "0.1.3"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Darcy Laycock"]
12
- s.date = %q{2010-05-03}
12
+ s.date = %q{2010-05-04}
13
13
  s.description = %q{Simple Namespace support for JS + Other niceties, packaged as a Barista framework}
14
14
  s.email = %q{sutto@sutto.net}
15
15
  s.extra_rdoc_files = [
16
16
  "README.md"
17
17
  ]
18
18
  s.files = [
19
- "README.md",
19
+ ".gitignore",
20
+ "README.md",
20
21
  "Rakefile",
21
22
  "coffeescripts/shuriken.coffee",
22
23
  "coffeescripts/shuriken/mixins.coffee",
23
24
  "coffeescripts/shuriken/mixins/callbacks.coffee",
25
+ "coffeescripts/shuriken/test.coffee",
26
+ "coffeescripts/shuriken/test/assertions.coffee",
27
+ "coffeescripts/shuriken/test/reporters.coffee",
28
+ "javascripts/shuriken.js",
29
+ "javascripts/shuriken/mixins.js",
30
+ "javascripts/shuriken/mixins/callbacks.js",
31
+ "javascripts/shuriken/test.js",
32
+ "javascripts/shuriken/test/assertions.js",
33
+ "javascripts/shuriken/test/reporters.js",
24
34
  "lib/shuriken.rb",
25
35
  "shuriken.gemspec",
26
- "wip-coffeescripts/test.coffee"
36
+ "tests.watchr",
37
+ "tests/basic_namespace_tests.coffee",
38
+ "tests/template.erb",
39
+ "vendor/jasmine-0.10.0/MIT.LICENSE",
40
+ "vendor/jasmine-0.10.0/README.markdown",
41
+ "vendor/jasmine-0.10.0/doc/files.html",
42
+ "vendor/jasmine-0.10.0/doc/index.html",
43
+ "vendor/jasmine-0.10.0/doc/symbols/_global_.html",
44
+ "vendor/jasmine-0.10.0/doc/symbols/jasmine.Block.html",
45
+ "vendor/jasmine-0.10.0/doc/symbols/jasmine.Clock.html",
46
+ "vendor/jasmine-0.10.0/doc/symbols/jasmine.Env.html",
47
+ "vendor/jasmine-0.10.0/doc/symbols/jasmine.JsApiReporter.html",
48
+ "vendor/jasmine-0.10.0/doc/symbols/jasmine.Matchers.html",
49
+ "vendor/jasmine-0.10.0/doc/symbols/jasmine.MultiReporter.html",
50
+ "vendor/jasmine-0.10.0/doc/symbols/jasmine.NestedResults.html",
51
+ "vendor/jasmine-0.10.0/doc/symbols/jasmine.Reporter.html",
52
+ "vendor/jasmine-0.10.0/doc/symbols/jasmine.Runner.html",
53
+ "vendor/jasmine-0.10.0/doc/symbols/jasmine.Spec.html",
54
+ "vendor/jasmine-0.10.0/doc/symbols/jasmine.Spy.html",
55
+ "vendor/jasmine-0.10.0/doc/symbols/jasmine.Suite.html",
56
+ "vendor/jasmine-0.10.0/doc/symbols/jasmine.html",
57
+ "vendor/jasmine-0.10.0/doc/symbols/jasmine.util.html",
58
+ "vendor/jasmine-0.10.0/doc/symbols/src/lib_TrivialReporter.js.html",
59
+ "vendor/jasmine-0.10.0/doc/symbols/src/src_Block.js.html",
60
+ "vendor/jasmine-0.10.0/doc/symbols/src/src_Env.js.html",
61
+ "vendor/jasmine-0.10.0/doc/symbols/src/src_JsApiReporter.js.html",
62
+ "vendor/jasmine-0.10.0/doc/symbols/src/src_Matchers.js.html",
63
+ "vendor/jasmine-0.10.0/doc/symbols/src/src_MultiReporter.js.html",
64
+ "vendor/jasmine-0.10.0/doc/symbols/src/src_NestedResults.js.html",
65
+ "vendor/jasmine-0.10.0/doc/symbols/src/src_PrettyPrinter.js.html",
66
+ "vendor/jasmine-0.10.0/doc/symbols/src/src_Queue.js.html",
67
+ "vendor/jasmine-0.10.0/doc/symbols/src/src_Reporter.js.html",
68
+ "vendor/jasmine-0.10.0/doc/symbols/src/src_Reporters.js.html",
69
+ "vendor/jasmine-0.10.0/doc/symbols/src/src_Runner.js.html",
70
+ "vendor/jasmine-0.10.0/doc/symbols/src/src_Spec.js.html",
71
+ "vendor/jasmine-0.10.0/doc/symbols/src/src_Suite.js.html",
72
+ "vendor/jasmine-0.10.0/doc/symbols/src/src_WaitsBlock.js.html",
73
+ "vendor/jasmine-0.10.0/doc/symbols/src/src_WaitsForBlock.js.html",
74
+ "vendor/jasmine-0.10.0/doc/symbols/src/src_base.js.html",
75
+ "vendor/jasmine-0.10.0/doc/symbols/src/src_mock-timeout.js.html",
76
+ "vendor/jasmine-0.10.0/doc/symbols/src/src_util.js.html",
77
+ "vendor/jasmine-0.10.0/example/example_runner.html",
78
+ "vendor/jasmine-0.10.0/example/spec/example_suite.js",
79
+ "vendor/jasmine-0.10.0/lib/TrivialReporter.js",
80
+ "vendor/jasmine-0.10.0/lib/consolex.js",
81
+ "vendor/jasmine-0.10.0/lib/jasmine-0.10.0.js",
82
+ "vendor/jasmine-0.10.0/lib/jasmine.css",
83
+ "vendor/jasmine-0.10.0/spec/runner.html",
84
+ "vendor/jasmine-0.10.0/spec/suites/CustomMatchersSpec.js",
85
+ "vendor/jasmine-0.10.0/spec/suites/EnvSpec.js",
86
+ "vendor/jasmine-0.10.0/spec/suites/ExceptionsSpec.js",
87
+ "vendor/jasmine-0.10.0/spec/suites/JsApiReporterSpec.js",
88
+ "vendor/jasmine-0.10.0/spec/suites/MatchersSpec.js",
89
+ "vendor/jasmine-0.10.0/spec/suites/MockClockSpec.js",
90
+ "vendor/jasmine-0.10.0/spec/suites/MultiReporterSpec.js",
91
+ "vendor/jasmine-0.10.0/spec/suites/NestedResultsSpec.js",
92
+ "vendor/jasmine-0.10.0/spec/suites/PrettyPrintSpec.js",
93
+ "vendor/jasmine-0.10.0/spec/suites/QueueSpec.js",
94
+ "vendor/jasmine-0.10.0/spec/suites/ReporterSpec.js",
95
+ "vendor/jasmine-0.10.0/spec/suites/RunnerSpec.js",
96
+ "vendor/jasmine-0.10.0/spec/suites/SpecRunningSpec.js",
97
+ "vendor/jasmine-0.10.0/spec/suites/SpecSpec.js",
98
+ "vendor/jasmine-0.10.0/spec/suites/SpySpec.js",
99
+ "vendor/jasmine-0.10.0/spec/suites/SuiteSpec.js",
100
+ "vendor/jasmine-0.10.0/spec/suites/TrivialReporterSpec.js",
101
+ "vendor/jasmine-0.10.0/spec/suites/UtilSpec.js",
102
+ "vendor/jquery.js",
103
+ "wip-coffeescripts/example_test.coffee",
104
+ "wip-coffeescripts/test.coffee",
105
+ "wip-coffeescripts/test/assertions.coffee",
106
+ "wip-coffeescripts/test/reporters.coffee"
27
107
  ]
28
108
  s.homepage = %q{http://github.com/Sutto/shuriken}
29
109
  s.rdoc_options = ["--charset=UTF-8"]
@@ -0,0 +1,114 @@
1
+ jasmine.include '../javascripts/shuriken.js', true
2
+
3
+ describe 'Shuriken', ->
4
+
5
+ root: {}
6
+
7
+ beforeEach ->
8
+ Shuriken.root: root
9
+
10
+ afterEach ->
11
+ delete root
12
+ root: {}
13
+ Shuriken.root: root
14
+
15
+ describe 'creating a namespace', ->
16
+
17
+ it 'should let you create a base namespace', ->
18
+ expect(root.MyNamespace).toBeUndefined()
19
+ Shuriken.as 'MyNamespace'
20
+ expect(root.MyNamespace).toBeDefined()
21
+
22
+ it 'should let you define a sub namespace', ->
23
+ expect(root.MyNamespace).toBeUndefined()
24
+ Shuriken.as 'MyNamespace'
25
+ expect(root.MyNamespace).toBeDefined()
26
+ expect(root.MyNamespace.X).toBeUndefined()
27
+ expect(root.MyNamespace.Y).toBeUndefined()
28
+ root.MyNamespace.withNS 'X', ->
29
+ expect(root.MyNamespace.X).toBeDefined()
30
+ expect(root.MyNamespace.Y).toBeUndefined()
31
+ root.MyNamespace.withNS 'Y.Z', ->
32
+ expect(root.MyNamespace.X).toBeDefined()
33
+ expect(root.MyNamespace.Y).toBeDefined()
34
+ expect(root.MyNamespace.Y.Z).toBeDefined()
35
+
36
+ it 'should correctly initialize namespaces as Shuriken.Namespace instances', ->
37
+ Shuriken.as 'MyNamespace'
38
+ root.MyNamespace.withNS 'X', ->
39
+ root.MyNamespace.withNS 'Y.Z', ->
40
+ expect(root.MyNamespace instanceof Shuriken.Namespace).toBeTruthy()
41
+ expect(root.MyNamespace.X instanceof Shuriken.Namespace).toBeTruthy()
42
+ expect(root.MyNamespace.Y instanceof Shuriken.Namespace).toBeTruthy()
43
+ expect(root.MyNamespace.Y.Z instanceof Shuriken.Namespace).toBeTruthy()
44
+
45
+ describe 'inspecting created namespaces', ->
46
+
47
+ beforeEach ->
48
+ Shuriken.as 'Doom'
49
+ root.Doom.withNS 'A.B.C', ->
50
+ root.Doom.withNS 'D', ->
51
+
52
+ it 'should return the correct value for the root namespace', ->
53
+ expect(root.Doom.toNSName()).toEqual 'Doom'
54
+
55
+ it 'should report the correct value for first level namespace names', ->
56
+ expect(root.Doom.A.toNSName()).toEqual 'Doom.A'
57
+ expect(root.Doom.D.toNSName()).toEqual 'Doom.D'
58
+
59
+ it 'should expect deeper nested namespaces to have the correct name', ->
60
+ expect(root.Doom.A.B.toNSName()).toEqual 'Doom.A.B'
61
+ expect(root.Doom.A.B.C.toNSName()).toEqual 'Doom.A.B.C'
62
+
63
+ it 'should correctly report the value of isRoot', ->
64
+ expect(root.Doom.isRoot()).toBeTruthy()
65
+ expect(root.Doom.A.isRoot()).toBeFalsy()
66
+ expect(root.Doom.A.B.isRoot()).toBeFalsy()
67
+ expect(root.Doom.A.B.C.isRoot()).toBeFalsy()
68
+ expect(root.Doom.D.isRoot()).toBeFalsy()
69
+
70
+ it 'should let you easily get the root namespace', ->
71
+ expect(root.Doom.getRootNS()).toEqual root.Doom
72
+ expect(root.Doom.A.getRootNS()).toEqual root.Doom
73
+ expect(root.Doom.A.B.getRootNS()).toEqual root.Doom
74
+ expect(root.Doom.A.B.C.getRootNS()).toEqual root.Doom
75
+ expect(root.Doom.D.getRootNS()).toEqual root.Doom
76
+
77
+ it 'should let you get a nested child namespace', ->
78
+ expect(root.Doom.getNS('A')).toEqual root.Doom.A
79
+ expect(root.Doom.getNS('A.B')).toEqual root.Doom.A.B
80
+ expect(root.Doom.getNS('A.B.C')).toEqual root.Doom.A.B.C
81
+ expect(root.Doom.getNS('D')).toEqual root.Doom.D
82
+ expect(root.Doom.A.getNS('B')).toEqual root.Doom.A.B
83
+ expect(root.Doom.A.getNS('B.C')).toEqual root.Doom.A.B.C
84
+ expect(root.Doom.A.B.getNS('C')).toEqual root.Doom.A.B.C
85
+ expect(root.Doom.getNS('Awesome')).toBeNull()
86
+ expect(root.Doom.getNS('A.Another')).toBeNull()
87
+ expect(root.Doom.getNS('Awesome.Nested')).toBeNull()
88
+ expect(root.Doom.getNS('Awesome.Ouch')).toBeNull()
89
+ expect(root.Doom.getNS('Awesome.Nested.Rocking')).toBeNull()
90
+
91
+ it 'should let you inspect the existence of namespaces', ->
92
+ expect(root.Doom.hasNS('A')).toBeTruthy()
93
+ expect(root.Doom.hasNS('A.B')).toBeTruthy()
94
+ expect(root.Doom.hasNS('A.B.C')).toBeTruthy()
95
+ expect(root.Doom.hasNS('D')).toBeTruthy()
96
+ expect(root.Doom.A.hasNS('B')).toBeTruthy()
97
+ expect(root.Doom.A.hasNS('B.C')).toBeTruthy()
98
+ expect(root.Doom.A.B.hasNS('C')).toBeTruthy()
99
+ expect(root.Doom.hasNS('Awesome')).toBeFalsy()
100
+ expect(root.Doom.hasNS('A.Another')).toBeFalsy()
101
+ expect(root.Doom.hasNS('Awesome.Nested')).toBeFalsy()
102
+ expect(root.Doom.hasNS('Awesome.Ouch')).toBeFalsy()
103
+ expect(root.Doom.hasNS('Awesome.Nested.Rocking')).toBeFalsy()
104
+
105
+ describe 'Shuriken.Util', ->
106
+
107
+ it 'should let you underscore a string', ->
108
+ expect(Shuriken.Util.underscoreize('A')).toEqual 'a'
109
+ expect(Shuriken.Util.underscoreize('A.B')).toEqual 'a/b'
110
+ expect(Shuriken.Util.underscoreize('A.B.C')).toEqual 'a/b/c'
111
+ expect(Shuriken.Util.underscoreize('NameOf.Doom')).toEqual 'name_of/doom'
112
+ expect(Shuriken.Util.underscoreize('Rockin.AndRoll.AndDoom')).toEqual 'rockin/and_roll/and_doom'
113
+ expect(Shuriken.Util.underscoreize('RPXNow')).toEqual 'rpx_now'
114
+ expect(Shuriken.Util.underscoreize('BHM.Authentication.RPXNow')).toEqual 'bhm/authentication/rpx_now'
@@ -0,0 +1,26 @@
1
+ <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
2
+ "http://www.w3.org/TR/html4/loose.dtd">
3
+ <html>
4
+ <head>
5
+ <title>Jasmine Test Runner</title>
6
+ </head>
7
+ <script type="text/javascript" src="../vendor/jasmine-0.10.0/lib/jasmine-0.10.0.js"></script>
8
+ <script type="text/javascript" src="../vendor/jasmine-0.10.0/lib/TrivialReporter.js"></script>
9
+ <script type="text/javascript" src="../vendor/jasmine-0.10.0/lib/consolex.js"></script>
10
+ <script type="text/javascript" src="../vendor/jquery.js"></script>
11
+ <link rel="stylesheet" type="text/css" href="../vendor/jasmine-0.10.0/lib/jasmine.css">
12
+
13
+ <script type="text/javascript">
14
+ jasmine.include('<%= $js_file %>', true);
15
+ </script>
16
+
17
+ <body>
18
+
19
+ <script type="text/javascript">
20
+ var jasmineEnv = jasmine.getEnv();
21
+ jasmineEnv.reporter = new jasmine.TrivialReporter();
22
+ jasmineEnv.execute();
23
+ </script>
24
+
25
+ </body>
26
+ </html>
data/tests.watchr ADDED
@@ -0,0 +1,6 @@
1
+ def compile!
2
+ system "rake test"
3
+ end
4
+
5
+ watch('coffeescripts/(.*)\.coffee') { compile! }
6
+ watch('tests/(.*)\.coffee') { compile! }
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2008 Pivotal Labs
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.