screw_server 0.1.7 → 0.1.8
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile.run.lock +2 -2
- data/assets/vendor/jslint/jslint.js +1 -1
- data/assets/vendor/screw-unit/EXAMPLE.html +4 -4
- data/assets/vendor/screw-unit/example/models/man.js +1 -1
- data/assets/vendor/screw-unit/example/spec/models/cat_spec.js +5 -5
- data/assets/vendor/screw-unit/example/spec/models/man_spec.js +4 -4
- data/assets/vendor/screw-unit/example/spec/suite.html +4 -4
- data/assets/vendor/screw-unit/lib/jquery-1.2.6.js +4 -4
- data/assets/vendor/screw-unit/lib/jquery.print.js +1 -1
- data/assets/vendor/screw-unit/lib/screw.behaviors.js +12 -12
- data/assets/vendor/screw-unit/lib/screw.builder.js +1 -1
- data/assets/vendor/screw-unit/lib/screw.css +2 -2
- data/assets/vendor/screw-unit/lib/screw.events.js +2 -2
- data/assets/vendor/screw-unit/lib/screw.matchers.js +5 -5
- data/assets/vendor/screw-unit/spec/behaviors_spec.js +18 -18
- data/assets/vendor/screw-unit/spec/matchers_spec.js +20 -20
- data/assets/vendor/screw-unit/spec/print_spec.js +16 -16
- data/assets/vendor/smoke/lib/smoke.core.js +7 -7
- data/assets/vendor/smoke/lib/smoke.mock.js +6 -6
- data/assets/vendor/smoke/lib/smoke.stub.js +1 -1
- data/assets/vendor/smoke/spec/core_spec.js +14 -14
- data/assets/vendor/smoke/spec/mock_spec.js +46 -46
- data/assets/vendor/smoke/spec/screw_integration_spec.js +2 -2
- data/assets/vendor/smoke/spec/stub_spec.js +2 -2
- data/assets/vendor/smoke/spec/su/jquery-1.2.3.js +203 -203
- data/assets/vendor/smoke/spec/su/jquery.print.js +3 -3
- data/assets/vendor/smoke/spec/su/screw.behaviors.js +12 -12
- data/assets/vendor/smoke/spec/su/screw.events.js +1 -1
- data/assets/vendor/smoke/spec/su/screw.matchers.js +9 -9
- data/assets/vendor/smoke/spec/suite.html +1 -1
- data/bin/screw_server +3 -1
- data/bundler_version.rb +1 -0
- data/lib/screw_server/app.rb +12 -8
- data/lib/screw_server/base.rb +3 -3
- data/lib/screw_server/spec_file.rb +7 -4
- data/screw_server.gemspec +11 -3
- data/views/run_spec.haml +3 -2
- metadata +9 -8
data/Gemfile.run.lock
CHANGED
@@ -19,7 +19,7 @@
|
|
19
19
|
<script src="lib/screw.events.js"></script>
|
20
20
|
<script src="lib/screw.behaviors.js"></script>
|
21
21
|
<link rel="stylesheet" href="lib/screw.css">
|
22
|
-
|
22
|
+
|
23
23
|
<script type="text/javascript">
|
24
24
|
// Here is the system under test (SUT)--that is, your application code that you would like
|
25
25
|
// to test.
|
@@ -27,7 +27,7 @@
|
|
27
27
|
return 2;
|
28
28
|
}
|
29
29
|
</script>
|
30
|
-
|
30
|
+
|
31
31
|
<script type="text/javascript">
|
32
32
|
// Here is a Custom Matcher. A custom matcher is a custom assertion,
|
33
33
|
// tailored to your application; these help to make your tests more readable.
|
@@ -40,7 +40,7 @@
|
|
40
40
|
}
|
41
41
|
}
|
42
42
|
</script>
|
43
|
-
|
43
|
+
|
44
44
|
<script type="text/javascript">
|
45
45
|
// Here is a sample test. Note that all tests are wrapped in
|
46
46
|
// "Screw.Unit(function() { ... })".
|
@@ -53,7 +53,7 @@
|
|
53
53
|
expect(foo()).to(equal, 2);
|
54
54
|
});
|
55
55
|
});
|
56
|
-
|
56
|
+
|
57
57
|
describe("numbers", function() {
|
58
58
|
// Here is a use of the custom matcher defined above.
|
59
59
|
it("either is or is not even", function() {
|
@@ -1,27 +1,27 @@
|
|
1
1
|
Screw.Unit(function() {
|
2
2
|
describe('Cat', function() {
|
3
3
|
var cat;
|
4
|
-
|
4
|
+
|
5
5
|
describe('#cross_path', function() {
|
6
6
|
describe('when the cat has black fur', function() {
|
7
7
|
before(function() {
|
8
8
|
cat = new Cat({color: 'black'});
|
9
9
|
});
|
10
|
-
|
10
|
+
|
11
11
|
it("decrements the man's luck by 5", function() {
|
12
12
|
var man = new Man({luck: 5});
|
13
13
|
cat.cross_path(man);
|
14
14
|
expect(man.luck()).to(equal, 0);
|
15
15
|
});
|
16
16
|
});
|
17
|
-
|
17
|
+
|
18
18
|
describe('when the cat has non-black fur', function() {
|
19
19
|
before(function() {
|
20
20
|
cat = new Cat({color: 'white'});
|
21
21
|
});
|
22
|
-
|
22
|
+
|
23
23
|
it("does not change the man's luck", function() {
|
24
|
-
var man = new Man({luck: 5});
|
24
|
+
var man = new Man({luck: 5});
|
25
25
|
cat.cross_path(man);
|
26
26
|
expect(man.luck()).to(equal, 5);
|
27
27
|
});
|
@@ -4,13 +4,13 @@ Screw.Unit(function() {
|
|
4
4
|
before(function() {
|
5
5
|
man = new Man({luck: 5});
|
6
6
|
});
|
7
|
-
|
7
|
+
|
8
8
|
describe('#decrement_luck', function() {
|
9
9
|
it("decrements the luck field by the given amount", function() {
|
10
10
|
man.decrement_luck(3);
|
11
11
|
expect(man.luck()).to(equal, 2)
|
12
12
|
});
|
13
|
-
|
13
|
+
|
14
14
|
describe('when the decrement exceeds the luck balance', function() {
|
15
15
|
it("decrements the luck field to zero", function() {
|
16
16
|
man.decrement_luck(10000000000);
|
@@ -18,12 +18,12 @@ Screw.Unit(function() {
|
|
18
18
|
});
|
19
19
|
});
|
20
20
|
});
|
21
|
-
|
21
|
+
|
22
22
|
describe('@click', function() {
|
23
23
|
before(function() {
|
24
24
|
$('#dom_test').append(man.render());
|
25
25
|
});
|
26
|
-
|
26
|
+
|
27
27
|
it("removes the man's hair", function() {
|
28
28
|
expect($('.man')).to(have, '.hair');
|
29
29
|
$('.man').click();
|
@@ -7,16 +7,16 @@
|
|
7
7
|
<script src="../../lib/screw.matchers.js"></script>
|
8
8
|
<script src="../../lib/screw.events.js"></script>
|
9
9
|
<script src="../../lib/screw.behaviors.js"></script>
|
10
|
-
|
10
|
+
|
11
11
|
<script src="spec_helper.js"></script>
|
12
12
|
<script src="matchers/have.js"></script>
|
13
|
-
|
13
|
+
|
14
14
|
<script src="../models/cat.js"></script>
|
15
15
|
<script src="../models/man.js"></script>
|
16
|
-
|
16
|
+
|
17
17
|
<script src="models/cat_spec.js"></script>
|
18
18
|
<script src="models/man_spec.js"></script>
|
19
|
-
|
19
|
+
|
20
20
|
<link rel="stylesheet" href="../../lib/screw.css">
|
21
21
|
</head>
|
22
22
|
<body>
|
@@ -582,7 +582,7 @@ jQuery.extend = jQuery.fn.extend = function() {
|
|
582
582
|
|
583
583
|
// Recurse if we're merging object values
|
584
584
|
if ( deep && copy && typeof copy == "object" && !copy.nodeType )
|
585
|
-
target[ name ] = jQuery.extend( deep,
|
585
|
+
target[ name ] = jQuery.extend( deep,
|
586
586
|
// Never move original objects, clone them
|
587
587
|
src || ( copy.length != null ? [ ] : { } )
|
588
588
|
, copy );
|
@@ -2882,7 +2882,7 @@ jQuery.extend({
|
|
2882
2882
|
|
2883
2883
|
if ( xml && data.documentElement.tagName == "parsererror" )
|
2884
2884
|
throw "parsererror";
|
2885
|
-
|
2885
|
+
|
2886
2886
|
// Allow a pre-filtering function to sanitize the response
|
2887
2887
|
if( filter )
|
2888
2888
|
data = filter( data, type );
|
@@ -3469,7 +3469,7 @@ jQuery.fn.extend({
|
|
3469
3469
|
parentOffset = /^body|html$/i.test(offsetParent[0].tagName) ? { top: 0, left: 0 } : offsetParent.offset();
|
3470
3470
|
|
3471
3471
|
// Subtract element margins
|
3472
|
-
// note: when an element has margin: auto the offsetLeft and marginLeft
|
3472
|
+
// note: when an element has margin: auto the offsetLeft and marginLeft
|
3473
3473
|
// are the same in Safari causing offset.left to incorrectly be 0
|
3474
3474
|
offset.top -= num( this, 'marginTop' );
|
3475
3475
|
offset.left -= num( this, 'marginLeft' );
|
@@ -3500,7 +3500,7 @@ jQuery.fn.extend({
|
|
3500
3500
|
// Create scrollLeft and scrollTop methods
|
3501
3501
|
jQuery.each( ['Left', 'Top'], function(i, name) {
|
3502
3502
|
var method = 'scroll' + name;
|
3503
|
-
|
3503
|
+
|
3504
3504
|
jQuery.fn[ method ] = function(val) {
|
3505
3505
|
if (!this[0]) return;
|
3506
3506
|
|
@@ -13,37 +13,37 @@
|
|
13
13
|
parent: function() {
|
14
14
|
return $(this).parent('.describes').parent('.describe');
|
15
15
|
},
|
16
|
-
|
16
|
+
|
17
17
|
run_befores: function() {
|
18
18
|
$(this).fn('parent').fn('run_befores');
|
19
19
|
$(this).children('.befores').children('.before').fn('run');
|
20
20
|
},
|
21
|
-
|
21
|
+
|
22
22
|
run_afters: function() {
|
23
23
|
$(this).fn('parent').fn('run_afters');
|
24
24
|
$(this).children('.afters').children('.after').fn('run');
|
25
25
|
},
|
26
|
-
|
26
|
+
|
27
27
|
enqueue: function() {
|
28
28
|
$(this).children('.its').children('.it').fn('enqueue');
|
29
29
|
$(this).children('.describes').children('.describe').fn('enqueue');
|
30
30
|
},
|
31
|
-
|
31
|
+
|
32
32
|
selector: function() {
|
33
33
|
return $(this).fn('parent').fn('selector')
|
34
34
|
+ ' > .describes > .describe:eq(' + $(this).parent('.describes').children('.describe').index(this) + ')';
|
35
35
|
}
|
36
36
|
});
|
37
|
-
|
37
|
+
|
38
38
|
$('body > .describe').fn({
|
39
39
|
selector: function() { return 'body > .describe' }
|
40
40
|
});
|
41
|
-
|
41
|
+
|
42
42
|
$('.it').fn({
|
43
43
|
parent: function() {
|
44
44
|
return $(this).parent('.its').parent('.describe');
|
45
45
|
},
|
46
|
-
|
46
|
+
|
47
47
|
run: function() {
|
48
48
|
var exception_during_spec;
|
49
49
|
try {
|
@@ -66,7 +66,7 @@
|
|
66
66
|
$(this).trigger('failed', [exception_to_report]);
|
67
67
|
}
|
68
68
|
},
|
69
|
-
|
69
|
+
|
70
70
|
enqueue: function() {
|
71
71
|
var self = $(this).trigger('enqueued');
|
72
72
|
$(Screw)
|
@@ -75,17 +75,17 @@
|
|
75
75
|
setTimeout(function() { $(Screw).dequeue() }, 0);
|
76
76
|
});
|
77
77
|
},
|
78
|
-
|
78
|
+
|
79
79
|
selector: function() {
|
80
80
|
return $(this).fn('parent').fn('selector')
|
81
81
|
+ ' > .its > .it:eq(' + $(this).parent('.its').children('.it').index(this) + ')';
|
82
82
|
}
|
83
83
|
});
|
84
|
-
|
84
|
+
|
85
85
|
$('.before').fn({
|
86
86
|
run: function() { $(this).data('screwunit.run')() }
|
87
|
-
});
|
88
|
-
|
87
|
+
});
|
88
|
+
|
89
89
|
$('.after').fn({
|
90
90
|
run: function() { $(this).data('screwunit.run')() }
|
91
91
|
});
|
@@ -62,7 +62,7 @@ html {
|
|
62
62
|
margin: 0 0 0.5em;
|
63
63
|
border-bottom: 1px solid transparent;
|
64
64
|
}
|
65
|
-
|
65
|
+
|
66
66
|
.describes .describe .its .it.enqueued h2 {
|
67
67
|
background-color: #CC6600;
|
68
68
|
color: white !important;
|
@@ -82,7 +82,7 @@ html {
|
|
82
82
|
margin-left: 1em;
|
83
83
|
color: #993300;
|
84
84
|
}
|
85
|
-
|
85
|
+
|
86
86
|
.describes .describe .its .it h2:hover {
|
87
87
|
cursor: pointer;
|
88
88
|
color: #000 !important;
|
@@ -1,6 +1,6 @@
|
|
1
1
|
(function($) {
|
2
2
|
$(Screw)
|
3
|
-
.bind('loaded', function() {
|
3
|
+
.bind('loaded', function() {
|
4
4
|
$('.describe, .it')
|
5
5
|
.click(function() {
|
6
6
|
document.location = location.href.split('?')[0] + '?' + $(this).fn('selector');
|
@@ -29,7 +29,7 @@
|
|
29
29
|
.append($('<p class="error"></p>').text(reason.toString()));
|
30
30
|
|
31
31
|
var file = reason.fileName || reason.sourceURL;
|
32
|
-
var line = reason.lineNumber || reason.line;
|
32
|
+
var line = reason.lineNumber || reason.line;
|
33
33
|
if (file || line) {
|
34
34
|
$(this).append($('<p class="error"></p>').text('line ' + line + ', ' + file));
|
35
35
|
}
|
@@ -38,12 +38,12 @@ Screw.Matchers = (function($) {
|
|
38
38
|
return 'expected ' + $.print(actual) + (not ? ' to not equal ' : ' to equal ') + $.print(expected);
|
39
39
|
}
|
40
40
|
},
|
41
|
-
|
41
|
+
|
42
42
|
be_gt: {
|
43
43
|
match: function(expected, actual) {
|
44
44
|
return actual > expected;
|
45
45
|
},
|
46
|
-
|
46
|
+
|
47
47
|
failure_message: function(expected, actual, not) {
|
48
48
|
return 'expected ' + $.print(actual) + (not ? ' to not ' : ' to ') + 'be greater than ' + $.print(expected);
|
49
49
|
}
|
@@ -53,7 +53,7 @@ Screw.Matchers = (function($) {
|
|
53
53
|
match: function(expected, actual) {
|
54
54
|
return actual >= expected;
|
55
55
|
},
|
56
|
-
|
56
|
+
|
57
57
|
failure_message: function(expected, actual, not) {
|
58
58
|
return 'expected ' + $.print(actual) + (not ? ' to not ' : ' to ') + 'be greater than or equal to ' + $.print(expected);
|
59
59
|
}
|
@@ -63,7 +63,7 @@ Screw.Matchers = (function($) {
|
|
63
63
|
match: function(expected, actual) {
|
64
64
|
return actual < expected;
|
65
65
|
},
|
66
|
-
|
66
|
+
|
67
67
|
failure_message: function(expected, actual, not) {
|
68
68
|
return 'expected ' + $.print(actual) + (not ? ' to not ' : ' to ') + 'be less than ' + $.print(expected);
|
69
69
|
}
|
@@ -73,7 +73,7 @@ Screw.Matchers = (function($) {
|
|
73
73
|
match: function(expected, actual) {
|
74
74
|
return actual <= expected;
|
75
75
|
},
|
76
|
-
|
76
|
+
|
77
77
|
failure_message: function(expected, actual, not) {
|
78
78
|
return 'expected ' + $.print(actual) + (not ? ' to not ' : ' to ') + 'be less than or equal to ' + $.print(expected);
|
79
79
|
}
|
@@ -30,33 +30,33 @@ Screw.Unit(function() {
|
|
30
30
|
expect(global_after_invoked).to(equal, true);
|
31
31
|
});
|
32
32
|
});
|
33
|
-
|
33
|
+
|
34
34
|
describe("a [describe] with a [before] and [after] block", function() {
|
35
35
|
var before_invoked = false, after_invoked = false;
|
36
36
|
before(function() { before_invoked = true });
|
37
37
|
after(function() { after_invoked = true });
|
38
|
-
|
38
|
+
|
39
39
|
describe('[after] blocks', function() {
|
40
40
|
it("does not invoke the [after] until after the first [it]", function() {
|
41
41
|
expect(after_invoked).to(equal, false);
|
42
42
|
});
|
43
|
-
|
43
|
+
|
44
44
|
it("invokes the [after] after the first [it]", function() {
|
45
45
|
expect(after_invoked).to(equal, true);
|
46
46
|
after_invoked = false;
|
47
47
|
});
|
48
|
-
|
48
|
+
|
49
49
|
it("invokes the [after] after each [it]", function() {
|
50
50
|
expect(after_invoked).to(equal, true);
|
51
51
|
});
|
52
52
|
});
|
53
|
-
|
53
|
+
|
54
54
|
describe('[before] blocks', function() {
|
55
55
|
it("invokes the [before] before an it", function() {
|
56
56
|
expect(before_invoked).to(equal, true);
|
57
57
|
before_invoked = false;
|
58
58
|
});
|
59
|
-
|
59
|
+
|
60
60
|
it("invokes the [before] before each it", function() {
|
61
61
|
expect(before_invoked).to(equal, true);
|
62
62
|
});
|
@@ -67,10 +67,10 @@ Screw.Unit(function() {
|
|
67
67
|
var before_invocations = [], after_invocations = [];
|
68
68
|
before(function() { before_invocations.push('before 1') });
|
69
69
|
before(function() { before_invocations.push('before 2') });
|
70
|
-
|
70
|
+
|
71
71
|
after(function() { after_invocations.push('after 1') });
|
72
72
|
after(function() { after_invocations.push('after 2') });
|
73
|
-
|
73
|
+
|
74
74
|
it("invokes the [before]s in lexical order before each [it]", function() {
|
75
75
|
expect(before_invocations).to(equal, ['before 1', 'before 2']);
|
76
76
|
});
|
@@ -91,15 +91,15 @@ Screw.Unit(function() {
|
|
91
91
|
after_invocations = [];
|
92
92
|
after_invocations.push("outermost after");
|
93
93
|
});
|
94
|
-
|
94
|
+
|
95
95
|
it("outside a nested [describe], does not invoke any of the nested's [before]s", function() {
|
96
96
|
expect(before_invocations).to(equal, ["outermost before"]);
|
97
97
|
});
|
98
|
-
|
98
|
+
|
99
99
|
it("outside a nested [describe], does not invoke any of the nested's [after]s", function() {
|
100
100
|
expect(after_invocations).to(equal, ["outermost after"]);
|
101
101
|
});
|
102
|
-
|
102
|
+
|
103
103
|
describe("a nested [describe]", function() {
|
104
104
|
before(function() {
|
105
105
|
before_invocations.push("inner before");
|
@@ -116,7 +116,7 @@ Screw.Unit(function() {
|
|
116
116
|
it("runs [after]s in the parent [describe] after each [it]", function() {
|
117
117
|
expect(after_invocations).to(equal, ["outermost after", "inner after"]);
|
118
118
|
});
|
119
|
-
|
119
|
+
|
120
120
|
describe("a doubly nested [describe]", function() {
|
121
121
|
before(function() {
|
122
122
|
before_invocations.push('innermost before');
|
@@ -125,22 +125,22 @@ Screw.Unit(function() {
|
|
125
125
|
after(function() {
|
126
126
|
after_invocations.push('innermost after');
|
127
127
|
});
|
128
|
-
|
128
|
+
|
129
129
|
describe('[before] blocks', function() {
|
130
130
|
it("runs [before]s in all ancestors before an [it]", function() {
|
131
131
|
expect(before_invocations).to(equal, ["outermost before", "inner before", "innermost before"]);
|
132
132
|
});
|
133
|
-
|
133
|
+
|
134
134
|
it("runs [before]s in all ancestors before each [it]", function() {
|
135
135
|
expect(before_invocations).to(equal, ["outermost before", "inner before", "innermost before"]);
|
136
136
|
});
|
137
137
|
});
|
138
|
-
|
138
|
+
|
139
139
|
describe('[after] blocks', function() {
|
140
140
|
it("runs [after]s in all ancestors after an [it]", function() {
|
141
141
|
expect(after_invocations).to(equal, ["outermost after", "inner after", "innermost after"]);
|
142
142
|
});
|
143
|
-
|
143
|
+
|
144
144
|
it("runs [after]s in all ancestors after each [it]", function() {
|
145
145
|
expect(after_invocations).to(equal, ["outermost after", "inner after", "innermost after"]);
|
146
146
|
});
|
@@ -154,12 +154,12 @@ Screw.Unit(function() {
|
|
154
154
|
after(function() {
|
155
155
|
after_invoked = true;
|
156
156
|
});
|
157
|
-
|
157
|
+
|
158
158
|
describe("an exception in a test", function() {
|
159
159
|
it("fails because it throws an exception", function() {
|
160
160
|
throw('an exception');
|
161
161
|
});
|
162
|
-
|
162
|
+
|
163
163
|
it("invokes [after]s even if the previous [it] raised an exception", function() {
|
164
164
|
expect(after_invoked).to(equal, true);
|
165
165
|
});
|