jasmine 0.4.4 → 0.4.5
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.
- data/jasmine/lib/{jasmine-0.10.0.js → jasmine-0.10.1.js} +16 -16
- data/spec/server_spec.rb +14 -0
- metadata +3 -3
@@ -15,7 +15,7 @@ jasmine.unimplementedMethod_ = function() {
|
|
15
15
|
/**
|
16
16
|
* Use <code>jasmine.undefined</code> instead of <code>undefined</code>, since <code>undefined</code is just
|
17
17
|
* a plain old variable and may be redefined by somebody else.
|
18
|
-
*
|
18
|
+
*
|
19
19
|
* @private
|
20
20
|
*/
|
21
21
|
jasmine.undefined = jasmine.___undefined___;
|
@@ -66,7 +66,7 @@ jasmine.ExpectationResult = function(params) {
|
|
66
66
|
|
67
67
|
/** @deprecated */
|
68
68
|
this.details = params.details;
|
69
|
-
|
69
|
+
|
70
70
|
this.message = this.passed_ ? 'Passed.' : params.message;
|
71
71
|
this.trace = this.passed_ ? '' : new Error(this.message);
|
72
72
|
};
|
@@ -89,11 +89,7 @@ jasmine.getEnv = function() {
|
|
89
89
|
* @returns {Boolean}
|
90
90
|
*/
|
91
91
|
jasmine.isArray_ = function(value) {
|
92
|
-
return value
|
93
|
-
typeof value === 'object' &&
|
94
|
-
typeof value.length === 'number' &&
|
95
|
-
typeof value.splice === 'function' &&
|
96
|
-
!(value.propertyIsEnumerable('length'));
|
92
|
+
return Object.prototype.toString.apply(value) === '[object Array]';
|
97
93
|
};
|
98
94
|
|
99
95
|
/**
|
@@ -350,6 +346,9 @@ jasmine.isSpy = function(putativeSpy) {
|
|
350
346
|
* @param {Array} methodNames array of names of methods to make spies
|
351
347
|
*/
|
352
348
|
jasmine.createSpyObj = function(baseName, methodNames) {
|
349
|
+
if (!jasmine.isArray_(methodNames) || methodNames.length == 0) {
|
350
|
+
throw new Error('createSpyObj requires a non-empty array of method names to create spies for');
|
351
|
+
}
|
353
352
|
var obj = {};
|
354
353
|
for (var i = 0; i < methodNames.length; i++) {
|
355
354
|
obj[methodNames[i]] = jasmine.createSpy(baseName + '.' + methodNames[i]);
|
@@ -1040,7 +1039,7 @@ jasmine.Matchers.matcherFn_ = function(matcherName, matcherFunction) {
|
|
1040
1039
|
var matcherArgs = jasmine.util.argsToArray(arguments);
|
1041
1040
|
var result = matcherFunction.apply(this, arguments);
|
1042
1041
|
if (this.reportWasCalled_) return result;
|
1043
|
-
|
1042
|
+
|
1044
1043
|
var message;
|
1045
1044
|
if (!result) {
|
1046
1045
|
if (this.message) {
|
@@ -1204,31 +1203,32 @@ jasmine.Matchers.prototype.wasNotCalled = function() {
|
|
1204
1203
|
*
|
1205
1204
|
*/
|
1206
1205
|
jasmine.Matchers.prototype.wasCalledWith = function() {
|
1206
|
+
var expectedArgs = jasmine.util.argsToArray(arguments);
|
1207
1207
|
if (!jasmine.isSpy(this.actual)) {
|
1208
1208
|
throw new Error('Expected a spy, but got ' + jasmine.Matchers.pp(this.actual) + '.');
|
1209
1209
|
}
|
1210
|
-
|
1211
1210
|
this.message = function() {
|
1212
1211
|
if (this.actual.callCount == 0) {
|
1213
|
-
return "Expected spy to have been called with " + jasmine.pp(
|
1212
|
+
return "Expected spy to have been called with " + jasmine.pp(expectedArgs) + " but it was never called.";
|
1214
1213
|
} else {
|
1215
|
-
return "Expected spy to have been called with " + jasmine.pp(
|
1214
|
+
return "Expected spy to have been called with " + jasmine.pp(expectedArgs) + " but was called with " + jasmine.pp(this.actual.argsForCall);
|
1216
1215
|
}
|
1217
1216
|
};
|
1218
1217
|
|
1219
|
-
return this.env.contains_(this.actual.argsForCall,
|
1218
|
+
return this.env.contains_(this.actual.argsForCall, expectedArgs);
|
1220
1219
|
};
|
1221
1220
|
|
1222
1221
|
jasmine.Matchers.prototype.wasNotCalledWith = function() {
|
1222
|
+
var expectedArgs = jasmine.util.argsToArray(arguments);
|
1223
1223
|
if (!jasmine.isSpy(this.actual)) {
|
1224
1224
|
throw new Error('Expected a spy, but got ' + jasmine.Matchers.pp(this.actual) + '.');
|
1225
1225
|
}
|
1226
1226
|
|
1227
1227
|
this.message = function() {
|
1228
|
-
return "Expected spy not to have been called with " + jasmine.pp(
|
1228
|
+
return "Expected spy not to have been called with " + jasmine.pp(expectedArgs) + " but it was";
|
1229
1229
|
};
|
1230
1230
|
|
1231
|
-
return !this.env.contains_(this.actual.argsForCall,
|
1231
|
+
return !this.env.contains_(this.actual.argsForCall, expectedArgs);
|
1232
1232
|
};
|
1233
1233
|
|
1234
1234
|
/**
|
@@ -2256,6 +2256,6 @@ window.clearInterval = function(timeoutKey) {
|
|
2256
2256
|
jasmine.version_= {
|
2257
2257
|
"major": 0,
|
2258
2258
|
"minor": 10,
|
2259
|
-
"build":
|
2260
|
-
"revision":
|
2259
|
+
"build": 1,
|
2260
|
+
"revision": 1267069453
|
2261
2261
|
};
|
data/spec/server_spec.rb
CHANGED
@@ -45,6 +45,12 @@ describe Jasmine::Server do
|
|
45
45
|
headers["Location"].should == "/"
|
46
46
|
end
|
47
47
|
|
48
|
+
it "should 404 non-existent files" do
|
49
|
+
code, headers, body = @thin_app.call("PATH_INFO" => "/some-non-existent-file", "SCRIPT_NAME" => "xxx")
|
50
|
+
code.should == 404
|
51
|
+
|
52
|
+
end
|
53
|
+
|
48
54
|
describe "/ page" do
|
49
55
|
it "should load each js file in order" do
|
50
56
|
code, headers, body = @thin_app.call("PATH_INFO" => "/", "SCRIPT_NAME" => "xxx", "REQUEST_METHOD" => 'GET')
|
@@ -54,6 +60,14 @@ describe Jasmine::Server do
|
|
54
60
|
body.should include("\"/spec/file2.js")
|
55
61
|
body.should satisfy {|s| s.index("/src/file1.js") < s.index("/spec/file2.js") }
|
56
62
|
end
|
63
|
+
|
64
|
+
it "should return an empty 200 for HEAD requests to /" do
|
65
|
+
code, headers, body = @thin_app.call("PATH_INFO" => "/", "SCRIPT_NAME" => "xxx", "REQUEST_METHOD" => 'HEAD')
|
66
|
+
code.should == 200
|
67
|
+
headers.should == { 'Content-Type' => 'text/html' }
|
68
|
+
body.should == ''
|
69
|
+
end
|
70
|
+
|
57
71
|
end
|
58
72
|
|
59
73
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jasmine
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Rajan Agaskar
|
@@ -10,7 +10,7 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date: 2010-02-
|
13
|
+
date: 2010-02-24 00:00:00 -08:00
|
14
14
|
default_executable: jasmine
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
@@ -96,7 +96,7 @@ files:
|
|
96
96
|
- jasmine/contrib/ruby/run.html
|
97
97
|
- jasmine/lib/TrivialReporter.js
|
98
98
|
- jasmine/lib/consolex.js
|
99
|
-
- jasmine/lib/jasmine-0.10.
|
99
|
+
- jasmine/lib/jasmine-0.10.1.js
|
100
100
|
- jasmine/lib/jasmine.css
|
101
101
|
- jasmine/lib/json2.js
|
102
102
|
- lib/jasmine.rb
|