screw_server 0.1.7 → 0.1.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (38) hide show
  1. data/Gemfile.run.lock +2 -2
  2. data/assets/vendor/jslint/jslint.js +1 -1
  3. data/assets/vendor/screw-unit/EXAMPLE.html +4 -4
  4. data/assets/vendor/screw-unit/example/models/man.js +1 -1
  5. data/assets/vendor/screw-unit/example/spec/models/cat_spec.js +5 -5
  6. data/assets/vendor/screw-unit/example/spec/models/man_spec.js +4 -4
  7. data/assets/vendor/screw-unit/example/spec/suite.html +4 -4
  8. data/assets/vendor/screw-unit/lib/jquery-1.2.6.js +4 -4
  9. data/assets/vendor/screw-unit/lib/jquery.print.js +1 -1
  10. data/assets/vendor/screw-unit/lib/screw.behaviors.js +12 -12
  11. data/assets/vendor/screw-unit/lib/screw.builder.js +1 -1
  12. data/assets/vendor/screw-unit/lib/screw.css +2 -2
  13. data/assets/vendor/screw-unit/lib/screw.events.js +2 -2
  14. data/assets/vendor/screw-unit/lib/screw.matchers.js +5 -5
  15. data/assets/vendor/screw-unit/spec/behaviors_spec.js +18 -18
  16. data/assets/vendor/screw-unit/spec/matchers_spec.js +20 -20
  17. data/assets/vendor/screw-unit/spec/print_spec.js +16 -16
  18. data/assets/vendor/smoke/lib/smoke.core.js +7 -7
  19. data/assets/vendor/smoke/lib/smoke.mock.js +6 -6
  20. data/assets/vendor/smoke/lib/smoke.stub.js +1 -1
  21. data/assets/vendor/smoke/spec/core_spec.js +14 -14
  22. data/assets/vendor/smoke/spec/mock_spec.js +46 -46
  23. data/assets/vendor/smoke/spec/screw_integration_spec.js +2 -2
  24. data/assets/vendor/smoke/spec/stub_spec.js +2 -2
  25. data/assets/vendor/smoke/spec/su/jquery-1.2.3.js +203 -203
  26. data/assets/vendor/smoke/spec/su/jquery.print.js +3 -3
  27. data/assets/vendor/smoke/spec/su/screw.behaviors.js +12 -12
  28. data/assets/vendor/smoke/spec/su/screw.events.js +1 -1
  29. data/assets/vendor/smoke/spec/su/screw.matchers.js +9 -9
  30. data/assets/vendor/smoke/spec/suite.html +1 -1
  31. data/bin/screw_server +3 -1
  32. data/bundler_version.rb +1 -0
  33. data/lib/screw_server/app.rb +12 -8
  34. data/lib/screw_server/base.rb +3 -3
  35. data/lib/screw_server/spec_file.rb +7 -4
  36. data/screw_server.gemspec +11 -3
  37. data/views/run_spec.haml +3 -2
  38. metadata +9 -8
@@ -5,47 +5,47 @@ Screw.Unit(function() {
5
5
  expect(true).to(equal, true);
6
6
  expect(true).to_not(equal, false);
7
7
  });
8
-
8
+
9
9
  describe('when actual is an object', function() {
10
10
  describe("when expected has the same keys and values", function() {
11
11
  it("matches successfully", function() {
12
12
  expect({a: 'b', c: 'd'}).to(equal, {a: 'b', c: 'd'});
13
13
  });
14
14
  });
15
-
15
+
16
16
  describe("when expected has different keys and values", function() {
17
17
  it("does not match", function() {
18
18
  expect({a: 'b', c: 'd', e: 'f'}).to_not(equal, {a: 'b', c: 'd', e: 'G'});
19
19
  });
20
20
  });
21
-
21
+
22
22
  describe("when expected is undefined", function() {
23
23
  it("does not match", function() {
24
24
  expect({}).to_not(equal, undefined);
25
25
  });
26
26
  });
27
27
  });
28
-
28
+
29
29
  describe("when actual is undefined", function() {
30
30
  describe("when expected is undefined", function() {
31
31
  it("matches successfully", function() {
32
32
  expect(undefined).to(equal, undefined);
33
33
  });
34
34
  });
35
-
35
+
36
36
  describe("when expected is an empty object", function() {
37
37
  it("does not match", function() {
38
38
  expect(undefined).to_not(equal, {});
39
39
  });
40
40
  });
41
41
  });
42
-
42
+
43
43
  describe('when actual is an array', function() {
44
44
  it("matches Arrays with the same elements", function() {
45
45
  expect([1, 2, 4]).to(equal, [1, 2, 4]);
46
46
  expect([1, 2, 3]).to_not(equal, [3, 2, 1]);
47
47
  });
48
-
48
+
49
49
  it("recursively applies equality to complex elements", function() {
50
50
  expect([{a: 'b'}, {c: 'd'}]).to(equal, [{a: 'b'}, {c: 'd'}]);
51
51
  expect([{a: 'b'}, {c: 'd'}]).to_not(equal, [{a: 'b'}, {c: 'E'}]);
@@ -71,13 +71,13 @@ Screw.Unit(function() {
71
71
  var message = null;
72
72
  try { expect(1).to(equal, 2) } catch(e) { message = e }
73
73
  expect(message).to(equal, 'expected 1 to equal 2');
74
-
74
+
75
75
  try { expect(1).to_not(equal, 1) } catch(e) { message = e }
76
76
  expect(message).to(equal, 'expected 1 to not equal 1');
77
77
  });
78
78
  });
79
79
  });
80
-
80
+
81
81
  describe('#match', function() {
82
82
  describe('when actual is a regular expression', function() {
83
83
  it("matches Strings produced by the grammar", function() {
@@ -85,7 +85,7 @@ Screw.Unit(function() {
85
85
  expect("The wheels of the bus").to_not(match, /boat/);
86
86
  });
87
87
  });
88
-
88
+
89
89
  describe('when actual is a string', function() {
90
90
  it("matches [expected]s containing [actual]s", function() {
91
91
  expect("The wheels of the bus").to(match, "wheels");
@@ -99,31 +99,31 @@ Screw.Unit(function() {
99
99
  expect("2 times").to_not(match, 3);
100
100
  });
101
101
  });
102
-
102
+
103
103
  describe(".failure_message", function() {
104
104
  it('prints "expected [actual] to (not) match [expected]', function() {
105
105
  var message = null;
106
106
  try { expect("hello").to(match, "schmello") } catch(e) { message = e }
107
107
  expect(message).to(equal, 'expected "hello" to match "schmello"');
108
-
108
+
109
109
  try { expect("hello").to_not(match, "ello") } catch(e) { message = e }
110
110
  expect(message).to(equal, 'expected "hello" to not match "ello"');
111
111
  });
112
112
  });
113
113
  });
114
-
114
+
115
115
  describe('#be_empty', function() {
116
116
  it("matches Arrays with no elements", function() {
117
117
  expect([]).to(be_empty);
118
118
  expect([1]).to_not(be_empty);
119
119
  });
120
-
120
+
121
121
  describe(".failure_message", function() {
122
122
  it("prints 'expected [actual] to (not) be empty", function() {
123
123
  var message = null;
124
124
  try { expect([1]).to(be_empty) } catch(e) { message = e }
125
125
  expect(message).to(equal, 'expected [ 1 ] to be empty');
126
-
126
+
127
127
  try { expect([]).to_not(be_empty) } catch(e) { message = e }
128
128
  expect(message).to(equal, 'expected [] to not be empty');
129
129
  });
@@ -142,7 +142,7 @@ Screw.Unit(function() {
142
142
  var message = null;
143
143
  try { expect([1, 2]).to(have_length, 4) } catch(e) { message = e }
144
144
  expect(message).to(equal, 'expected [ 1, 2 ] to have length 4');
145
-
145
+
146
146
  try { expect([1]).to_not(have_length, 1) } catch(e) { message = e }
147
147
  expect(message).to(equal, 'expected [ 1 ] to not have length 1');
148
148
  });
@@ -243,7 +243,7 @@ Screw.Unit(function() {
243
243
  var message = false;
244
244
  try { expect(elt).to(match_selector, 'div.bar') } catch(e) { message = e }
245
245
  expect(message).to(equal, 'expected $([ <div class="foo"> ]) to match selector div.bar');
246
-
246
+
247
247
  try { expect(elt).to_not(match_selector, 'div.foo') } catch(e) { message = e }
248
248
  expect(message).to(equal, 'expected $([ <div class="foo"> ]) to not match selector div.foo');
249
249
  });
@@ -289,7 +289,7 @@ Screw.Unit(function() {
289
289
  var message = null;
290
290
  try { expect(1).to(be_gt, 2) } catch(e) { message = e }
291
291
  expect(message).to(equal, 'expected 1 to be greater than 2');
292
-
292
+
293
293
  try { expect(2).to_not(be_gt, 1) } catch(e) { message = e }
294
294
  expect(message).to(equal, 'expected 2 to not be greater than 1');
295
295
  });
@@ -314,7 +314,7 @@ Screw.Unit(function() {
314
314
  var message = null;
315
315
  try { expect(1).to(be_gte, 2) } catch(e) { message = e }
316
316
  expect(message).to(equal, 'expected 1 to be greater than or equal to 2');
317
-
317
+
318
318
  try { expect(2).to_not(be_gte, 1) } catch(e) { message = e }
319
319
  expect(message).to(equal, 'expected 2 to not be greater than or equal to 1');
320
320
  });
@@ -337,7 +337,7 @@ Screw.Unit(function() {
337
337
  var message = null;
338
338
  try { expect(2).to(be_lt, 1) } catch(e) { message = e }
339
339
  expect(message).to(equal, 'expected 2 to be less than 1');
340
-
340
+
341
341
  try { expect(1).to_not(be_lt, 2) } catch(e) { message = e }
342
342
  expect(message).to(equal, 'expected 1 to not be less than 2');
343
343
  });
@@ -5,13 +5,13 @@ Screw.Unit(function() {
5
5
  expect($.print(undefined)).to(equal, 'undefined');
6
6
  });
7
7
  });
8
-
8
+
9
9
  describe('when given null', function() {
10
10
  it("returns 'null'", function() {
11
11
  expect($.print(null)).to(equal, 'null');
12
12
  });
13
13
  });
14
-
14
+
15
15
  describe('when given a number', function() {
16
16
  it("returns the string representation of the number", function() {
17
17
  expect($.print(1)).to(equal, '1');
@@ -19,39 +19,39 @@ Screw.Unit(function() {
19
19
  expect($.print(-1)).to(equal, '-1');
20
20
  });
21
21
  });
22
-
22
+
23
23
  describe('when given a boolean', function() {
24
24
  it("returns the string representation of the boolean", function() {
25
25
  expect($.print(true)).to(equal, 'true');
26
26
  expect($.print(false)).to(equal, 'false');
27
27
  });
28
28
  });
29
-
29
+
30
30
  describe('when given a string', function() {
31
31
  it("returns the string, quoted", function() {
32
32
  expect($.print('asdf')).to(equal, '"asdf"');
33
33
  });
34
-
34
+
35
35
  describe('when the string is longer than the [max_string] option', function() {
36
36
  it("returns the string, truncated", function() {
37
37
  expect($.print('asdf', { max_string: 3 })).to(equal, '"asd..."');
38
- });
38
+ });
39
39
  });
40
-
40
+
41
41
  describe('when the strings has quotes or escaped characters', function() {
42
42
  it("returns the string, with quotes and escaped characters escaped", function() {
43
43
  expect($.print('as"df')).to(equal, '"as\\"df"');
44
44
  expect($.print('as\tdf')).to(equal, '"as\\tdf"');
45
- });
45
+ });
46
46
  });
47
47
  });
48
-
48
+
49
49
  describe('when given a function', function() {
50
50
  it("returns the function's signature", function() {
51
51
  expect($.print(function() {})).to(match, /function\s*\(\)/);
52
52
  expect($.print(function foo() {})).to(match, /function\s*foo\(\)/);
53
53
  expect($.print(function foo(bar) {})).to(match, /function\s*foo\(bar\)/);
54
- });
54
+ });
55
55
  });
56
56
 
57
57
  describe('when given a RegExp', function() {
@@ -71,7 +71,7 @@ Screw.Unit(function() {
71
71
  expect($.print(0)).to(equal, '0');
72
72
  });
73
73
  });
74
-
74
+
75
75
  describe('when given an element', function() {
76
76
  it("returns the string representation of the element", function() {
77
77
  expect($.print($('<div></div>').get(0))).to(equal, '<div>');
@@ -92,13 +92,13 @@ Screw.Unit(function() {
92
92
  expect($.print([1])).to(equal, '[ 1 ]');
93
93
  expect($.print([1, 2, 3])).to(equal, '[ 1, 2, 3 ]');
94
94
  });
95
-
95
+
96
96
  describe('when the array is longer than the [max_array] option', function() {
97
97
  it("returns the printed array, truncated", function() {
98
98
  expect($.print([1, 2, 3, 4], { max_array: 2 })).to(equal, '[ 1, 2, 2 more... ]');
99
99
  });
100
100
  });
101
-
101
+
102
102
  describe('when the array has arrays as its elements', function() {
103
103
  it("returns the recursively printed array", function() {
104
104
  expect($.print([[]])).to(equal, '[ [] ]');
@@ -127,7 +127,7 @@ Screw.Unit(function() {
127
127
  expect($.print($('<div></div>'))).to(equal, '$([ <div> ])');
128
128
  });
129
129
  });
130
-
130
+
131
131
  describe('when given a NodeList', function() {
132
132
  it("returns the printed array of elements in the list", function() {
133
133
  expect($.print(document.getElementsByTagName('body'))).to(equal, '[ <body> ]');
@@ -139,12 +139,12 @@ Screw.Unit(function() {
139
139
  expect($.print({})).to(equal, '{}');
140
140
  expect($.print({ foo: 1, bar: 2 })).to(equal, '{ foo: 1, bar: 2 }');
141
141
  });
142
-
142
+
143
143
  describe('when the values of the object are non-primitive', function() {
144
144
  it("recursively prints the keys and values", function() {
145
145
  expect($.print({ foo: [1, 2] })).to(equal, '{ foo: [ 1, 2 ] }');
146
146
  });
147
-
147
+
148
148
  describe('when the object has circular references', function() {
149
149
  it("returns elipses for circularities", function() {
150
150
  var circular = {};
@@ -3,14 +3,14 @@ Smoke = {
3
3
  // use the jquery print plugin if it is available or fall back to toString();
4
4
  return (jQuery && jQuery.print) ? jQuery.print(v) : v.toString();
5
5
  },
6
-
7
- printArguments: function(args) {
6
+
7
+ printArguments: function(args) {
8
8
  var a = [];
9
9
  if (args === undefined) args = '';
10
10
  if ((args && args.callee) || (args instanceof Array)) {
11
11
  for(var i = 0; i < args.length; i++) {
12
12
  a.push(Smoke.print(args[i]));
13
- }
13
+ }
14
14
  } else {
15
15
  // Workaround for jQuery.print returning "null" when called with an empty string.
16
16
  if (!args && (typeof args == 'string')) {
@@ -21,11 +21,11 @@ Smoke = {
21
21
  }
22
22
  return '(' + a.join(', ') + ')';
23
23
  },
24
-
25
- argumentsToArray: function(args) {
24
+
25
+ argumentsToArray: function(args) {
26
26
  return Array.prototype.slice.call(args);
27
27
  },
28
-
28
+
29
29
  compare: function(a, b) {
30
30
  if (a === b) return true;
31
31
  if (a instanceof Array) {
@@ -42,7 +42,7 @@ Smoke = {
42
42
  }
43
43
  return true;
44
44
  },
45
-
45
+
46
46
  compareArguments: function(a, b) {
47
47
  return this.compare(Smoke.argumentsToArray(a), Smoke.argumentsToArray(b));
48
48
  }
@@ -34,7 +34,7 @@ Smoke.Mock = function(originalObj) {
34
34
  }
35
35
  return new Smoke.Stub(this, attr);
36
36
  };
37
-
37
+
38
38
  obj.should_receive = function(attr){
39
39
  var expectation = new Smoke.Mock.Expectation(this, attr);
40
40
  this._expectations[attr] = (this._expectations[attr] || []).concat([expectation]);
@@ -43,7 +43,7 @@ Smoke.Mock = function(originalObj) {
43
43
  }
44
44
  if(this._expectations[attr].length == 1) {
45
45
  this[attr] = Smoke.Mock.Expectation.stub(this, attr);
46
- }
46
+ }
47
47
  return expectation;
48
48
  };
49
49
 
@@ -63,12 +63,12 @@ Smoke.Mock = function(originalObj) {
63
63
  for(var i=0; i < expectations.length; i++) expectations[i].check();
64
64
  };
65
65
  };
66
-
66
+
67
67
  obj._resetMocks = function(){
68
68
  for(var attr in this._valuesBeforeMocking) {
69
69
  this[attr] = this._valuesBeforeMocking[attr];
70
70
  }
71
-
71
+
72
72
  delete this._valuesBeforeMocking;
73
73
  delete this._expectations;
74
74
  delete this._resetMocks;
@@ -76,7 +76,7 @@ Smoke.Mock = function(originalObj) {
76
76
  delete this.stub;
77
77
  delete this.should_receive;
78
78
  };
79
-
79
+
80
80
  Smoke.mocks.push(obj);
81
81
  return obj;
82
82
  };
@@ -208,7 +208,7 @@ Smoke.Mock.Expectation.prototype = {
208
208
  },
209
209
  parseCount: function(c){
210
210
  switch(c){
211
- case 'once':
211
+ case 'once':
212
212
  return 1;
213
213
  case 'twice':
214
214
  return 2;
@@ -5,7 +5,7 @@ Smoke.Stub = function(obj,attr) {
5
5
  };
6
6
 
7
7
  Smoke.Stub.prototype = {
8
- defaultReturn: null,
8
+ defaultReturn: null,
9
9
  property: function(p){
10
10
  this.property = p;
11
11
  this.and_set_to(this.defaultReturn);
@@ -1,5 +1,5 @@
1
1
  Screw.Unit(function() {
2
- describe("core", function() {
2
+ describe("core", function() {
3
3
  var anonymous_function = function() { return arguments };
4
4
  describe("printArguments", function() {
5
5
  it("should return '()' is the arguments are empty", function() {
@@ -14,20 +14,20 @@ Screw.Unit(function() {
14
14
  var args = anonymous_function(1,2);
15
15
  expect(Smoke.printArguments(args)).to(equal, '(1, 2)');
16
16
  });
17
-
17
+
18
18
  it("should handle being passed something other than an array or arguments object", function() {
19
19
  expect(Smoke.printArguments(false)).to(equal, '(false)');
20
20
  });
21
21
  });
22
-
22
+
23
23
  describe("argumentsToArray", function() {
24
24
  it("should return an array", function() {
25
25
  expect(Smoke.argumentsToArray(anonymous_function(1,2)) instanceof Array).to(equal, true);
26
26
  });
27
-
27
+
28
28
  it("should return the arguments in an array", function() {
29
- expect(Smoke.argumentsToArray(anonymous_function(1,2))).to(equal, [1,2]);
30
- });
29
+ expect(Smoke.argumentsToArray(anonymous_function(1,2))).to(equal, [1,2]);
30
+ });
31
31
  });
32
32
 
33
33
  describe("compare", function() {
@@ -40,7 +40,7 @@ Screw.Unit(function() {
40
40
  it("should return true if the two nested arrays are equal", function() {
41
41
  expect(Smoke.compare(nested_array, [[1,2], [3,4]])).to(equal, true);
42
42
  });
43
-
43
+
44
44
  it("should return false if the two arrays are not equal", function() {
45
45
  expect(Smoke.compare(array, [1,2,3,4])).to(equal, false);
46
46
  })
@@ -49,7 +49,7 @@ Screw.Unit(function() {
49
49
  expect(Smoke.compare(nested_array, [[1,2],[3]])).to(equal, false);
50
50
  })
51
51
  });
52
-
52
+
53
53
  describe("with objects", function() {
54
54
  var object = { foo: 'bar' }, nested_object = { foo: { a: 'b' }, bar: { c: 'd'} };
55
55
  it("should return true if the two objects are equal", function() {
@@ -59,7 +59,7 @@ Screw.Unit(function() {
59
59
  it("should return true if the two nested objects are equal", function() {
60
60
  expect(Smoke.compare(nested_object, { foo: { a: 'b' }, bar: { c: 'd'} })).to(equal, true);
61
61
  });
62
-
62
+
63
63
  it("should return false if the two objects are not equal", function() {
64
64
  expect(Smoke.compare(object, {bar: 'foo'})).to(equal, false);
65
65
  });
@@ -67,9 +67,9 @@ Screw.Unit(function() {
67
67
  it("should return false if the two nested objects are not equal", function() {
68
68
  expect(Smoke.compare(nested_object, { foo: { c: 'd' }, bar: { a: 'b' } })).to(equal, false);
69
69
  });
70
-
70
+
71
71
  it("should return false if an one of the objects has an additional property", function() {
72
- expect(Smoke.compare(object, { foo: 'bar', bar: 'foo' })).to(equal, false);
72
+ expect(Smoke.compare(object, { foo: 'bar', bar: 'foo' })).to(equal, false);
73
73
  })
74
74
  });
75
75
 
@@ -82,7 +82,7 @@ Screw.Unit(function() {
82
82
  it("should return true if the two numbers are equal", function() {
83
83
  expect(Smoke.compare(number, 1)).to(equal, true);
84
84
  });
85
-
85
+
86
86
  it("should return false if the two strings are not equal", function() {
87
87
  expect(Smoke.compare(string, 'bar')).to(equal, false);
88
88
  });
@@ -101,7 +101,7 @@ Screw.Unit(function() {
101
101
  it("should return false if the two arrays with mixed types are not equal", function() {
102
102
  expect(Smoke.compare(array, [1, { foo: 'bar'}, 3])).to(equal, false);
103
103
  });
104
-
104
+
105
105
  it("should return true if the two objects with mixed types are equal", function() {
106
106
  expect(Smoke.compare(object, { foo: [1,2,3], bar: 'foo', one: 1 })).to(equal, true);
107
107
  });
@@ -110,6 +110,6 @@ Screw.Unit(function() {
110
110
  expect(Smoke.compare(object, { foo: [1,2,3], bar: 'foo', two: 3 })).to(equal, false);
111
111
  });
112
112
  })
113
- });
113
+ });
114
114
  });
115
115
  });