jspec 2.11.5 → 2.11.6

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,4 +1,14 @@
1
1
 
2
+ === 2.11.6 / 2009-10-12
3
+
4
+ * Added Tony to contributor list
5
+ * Removed JSpec.paramsFor()
6
+ * Removed module contexts [#72]
7
+ * Fixed some css styling issues in IE8 [#71]
8
+ * Fixed; DOM formatter supporting \r\n \r \n for EOL in the body source [Thanks Tony]
9
+ * Fixed "Access is denied" error in IE
10
+ * Fixed some css support for older browsers [Thanks Tony]
11
+
2
12
  === 2.11.5 / 2009-10-10
3
13
 
4
14
  * Fixed dependencies (created by github's gem builder removal)
@@ -793,6 +793,7 @@ JSpec more enjoyable, and bug free ;)
793
793
  * Lawrence Pit
794
794
  * mpd@jesters-court.ne
795
795
  * kevin.gisi@gmail.com
796
+ * tony_t_tubbs@yahoo.com
796
797
  * enno84@gmx.net
797
798
  * fnando
798
799
 
data/bin/jspec CHANGED
@@ -12,7 +12,7 @@ require 'server/server'
12
12
  RHINO = 'java org.mozilla.javascript.tools.shell.Main'
13
13
 
14
14
  program :name, 'JSpec'
15
- program :version, '2.11.5'
15
+ program :version, '2.11.6'
16
16
  program :description, 'JavaScript BDD Testing Framework'
17
17
  default_command :bind
18
18
 
@@ -2,11 +2,11 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{jspec}
5
- s.version = "2.11.5"
5
+ s.version = "2.11.6"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["TJ Holowaychuk"]
9
- s.date = %q{2009-10-10}
9
+ s.date = %q{2009-10-12}
10
10
  s.default_executable = %q{jspec}
11
11
  s.description = %q{JavaScript BDD Testing Framework}
12
12
  s.email = %q{tj@vision-media.ca}
@@ -2,10 +2,11 @@ body.jspec {
2
2
  margin: 45px 0;
3
3
  font: 12px "Helvetica Neue Light", "Lucida Grande", "Calibri", "Arial", sans-serif;
4
4
  background: #efefef url(images/bg.png) top left repeat-x;
5
+ text-align: center;
5
6
  }
6
7
  #jspec {
7
8
  margin: 0 auto;
8
- padding-top: 25px;
9
+ padding-top: 30px;
9
10
  width: 1008px;
10
11
  background: url(images/vr.png) top left repeat-y;
11
12
  text-align: left;
@@ -30,8 +31,8 @@ body.jspec {
30
31
  background: url(images/loading.gif) 50% 50% no-repeat;
31
32
  }
32
33
  #jspec-title {
33
- position: relative;
34
- top: 35px;
34
+ position: absolute;
35
+ top: 15px;
35
36
  left: 20px;
36
37
  width: 160px;
37
38
  font-size: 22px;
@@ -74,7 +75,6 @@ body.jspec {
74
75
  color: #FA1616;
75
76
  }
76
77
  #jspec-report table {
77
- width: 100%;
78
78
  font-size: 11px;
79
79
  border-collapse: collapse;
80
80
  }
@@ -90,7 +90,8 @@ body.jspec {
90
90
  margin: 0;
91
91
  padding: 0 0 5px 25px;
92
92
  }
93
- #jspec-report tr:not(.body):hover + tr.body {
93
+ #jspec-report tr.even:hover + tr.body,
94
+ #jspec-report tr.odd:hover + tr.body {
94
95
  display: block;
95
96
  }
96
97
  #jspec-report tr td:first-child em {
@@ -98,7 +99,8 @@ body.jspec {
98
99
  font-weight: normal;
99
100
  color: #7B8D9B;
100
101
  }
101
- #jspec-report tr:not(.description):hover {
102
+ #jspec-report tr.even:hover,
103
+ #jspec-report tr.odd:hover {
102
104
  text-shadow: 1px 1px 1px #fff;
103
105
  background: #F2F5F7;
104
106
  }
@@ -5,7 +5,7 @@
5
5
 
6
6
  JSpec = {
7
7
 
8
- version : '2.11.5',
8
+ version : '2.11.6',
9
9
  cache : {},
10
10
  suites : [],
11
11
  modules : [],
@@ -143,7 +143,7 @@
143
143
  return JSpec.
144
144
  escape(JSpec.contentsOf(body)).
145
145
  replace(/^ */gm, function(a){ return (new Array(Math.round(a.length / 3))).join(' ') }).
146
- replace("\n", '<br/>')
146
+ replace(/\r\n|\r|\n/gm, '<br/>')
147
147
  }
148
148
 
149
149
  report.innerHTML = '<div id="jspec-report" class="' + classes + '"><div class="heading"> \
@@ -726,14 +726,9 @@
726
726
  */
727
727
 
728
728
  evalHook : function(module, name, args) {
729
- var context = this.context || this.defaultContext
730
- var contents = this.contentsOf(module[name])
731
- var params = this.paramsFor(module[name])
732
- module.utilities = module.utilities || {}
733
- params.unshift('context'); args.unshift(context)
734
- hook('evaluatingHookBody', module, name, context)
735
- try { return new Function(params.join(), 'with (this.utilities) { with (context) { with (JSpec) { ' + contents + ' }}}').apply(module, args) }
736
- catch(e) { error('Error in hook ' + module.name + "." + name + ': ', e) }
729
+ hook('evaluatingHookBody', module, name)
730
+ try { return module[name].apply(module, args) }
731
+ catch(e) { error('Error in hook ' + module.name + '.' + name + ': ', e) }
737
732
  },
738
733
 
739
734
  /**
@@ -1311,18 +1306,6 @@
1311
1306
  contentsOf : function(body) {
1312
1307
  return body.toString().match(/^[^\{]*{((.*\n*)*)}/m)[1]
1313
1308
  },
1314
-
1315
- /**
1316
- * Return param names for a function body.
1317
- *
1318
- * @param {function} body
1319
- * @return {array}
1320
- * @api public
1321
- */
1322
-
1323
- paramsFor : function(body) {
1324
- return body.toString().match(/\((.*?)\)/)[1].match(/[\w]+/g) || []
1325
- },
1326
1309
 
1327
1310
  /**
1328
1311
  * Evaluate a JSpec capture body.
@@ -1549,12 +1532,33 @@
1549
1532
  /**
1550
1533
  * Instantiate an XMLHttpRequest.
1551
1534
  *
1535
+ * Here we utilize IE's lame ActiveXObjects first which
1536
+ * allow IE access serve files via the file: protocol, otherwise
1537
+ * we then default to XMLHttpRequest.
1538
+ *
1552
1539
  * @return {XMLHttpRequest, ActiveXObject}
1553
1540
  * @api private
1554
1541
  */
1555
1542
 
1556
1543
  xhr : function() {
1557
- return new (JSpec.request || ActiveXObject("Microsoft.XMLHTTP"))
1544
+ return this.ieXhr() || new JSpec.request
1545
+ },
1546
+
1547
+ /**
1548
+ * Return Microsoft piece of crap ActiveXObject.
1549
+ *
1550
+ * @return {ActiveXObject}
1551
+ * @api public
1552
+ */
1553
+
1554
+ ieXhr : function() {
1555
+ function object(str) {
1556
+ try { return new ActiveXObject(str) } catch(e) {}
1557
+ }
1558
+ return object('Msxml2.XMLHTTP.6.0') ||
1559
+ object('Msxml2.XMLHTTP.3.0') ||
1560
+ object('Msxml2.XMLHTTP') ||
1561
+ object('Microsoft.XMLHTTP')
1558
1562
  },
1559
1563
 
1560
1564
  /**
@@ -1601,7 +1605,7 @@
1601
1605
  request.send(null)
1602
1606
  if (request.readyState == 4 &&
1603
1607
  (request.status == 0 ||
1604
- parseInt(request.status.toString()[0]) == 2))
1608
+ request.status.toString().charAt(0) == 2))
1605
1609
  return request.responseText
1606
1610
  }
1607
1611
  else
@@ -167,7 +167,7 @@
167
167
  // --- Hooks
168
168
 
169
169
  afterSpec : function() {
170
- this.utilities.unmockRequest()
170
+ unmockRequest()
171
171
  },
172
172
 
173
173
  // --- DSLs
@@ -34,14 +34,10 @@ JSpec.include({
34
34
  randomHook : function(a, b) {
35
35
  return [a, b]
36
36
  },
37
- beforeSpec : function() { addedBeforeSpec = true; doFoo() },
37
+ beforeSpec : function() { addedBeforeSpec = true; this.utilities.doFoo() },
38
38
  afterSpec : function() { addedAfterSpec = true },
39
39
  beforeSuite : function() { addedBeforeSuite = true },
40
40
  afterSuite : function() { addedAfterSuite = true },
41
- checkJSpecContext : function(){ return each },
42
- checkContext : function() { return fixture('test') },
43
- checkModuleContext : function() { return this.name },
44
- checkUtilityContext : function() { return doFoo() },
45
41
  matchers : {
46
42
  be_foo_bar : function() {
47
43
  return true
@@ -19,22 +19,6 @@ describe 'JSpec'
19
19
  it 'should run afterSuite'
20
20
  addedAfterSuite.should.be_true
21
21
  end
22
-
23
- it 'should run in context with JSpec'
24
- hook('checkJSpecContext')[0].should.equal JSpec.each
25
- end
26
-
27
- it 'should run in context to JSpecs default context'
28
- hook('checkContext')[0].should.eql fixture('test')
29
- end
30
-
31
- it 'should run in context to the module itself'
32
- hook('checkModuleContext')[0].should.eql 'ExampleModule'
33
- end
34
-
35
- it 'should run in context to the modules utilities'
36
- hook('checkUtilityContext')[0].should.eql 'foo'
37
- end
38
22
  end
39
23
 
40
24
  describe '.hook()'
@@ -259,21 +259,4 @@ describe 'Utility'
259
259
  end
260
260
  end
261
261
 
262
- describe 'paramsFor()'
263
- it 'should return an array of function parameter names'
264
- JSpec.paramsFor(function(foo, bar){}).should.eql ['foo', 'bar']
265
- end
266
-
267
- it 'should return only the params for the root function'
268
- foo = function(bar){
269
- function baz(test) {}
270
- var something = function(foo, bar){}
271
- }
272
- JSpec.paramsFor(foo).should.eql ['bar']
273
- end
274
-
275
- it 'should return empty array when no params are present'
276
- JSpec.paramsFor(function(){}).should.eql []
277
- end
278
- end
279
262
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jspec
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.11.5
4
+ version: 2.11.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - TJ Holowaychuk
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-10-10 00:00:00 -07:00
12
+ date: 2009-10-12 00:00:00 -07:00
13
13
  default_executable: jspec
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency