visionmedia-jspec 2.4.2 → 2.4.3

Sign up to get free protection for your applications and to get access to all the features.
data/History.rdoc CHANGED
@@ -1,4 +1,10 @@
1
1
 
2
+ === 2.4.3 / 2009-07-02
3
+
4
+ * Fixed matcher semicolon matcher issue when using the JSpec grammar
5
+ * Added pass() util; Spec#pass() and Spec#fail() (thanks gisikw)
6
+ * Removing Object.prototype.stubby() after specs are finished to prevent pollution
7
+
2
8
  === 2.4.2 / 2009-06-30
3
9
 
4
10
  * Fixed trailing comma (thanks Kevin)
data/bin/jspec CHANGED
@@ -11,7 +11,7 @@ require 'fileutils'
11
11
  RHINO = 'java org.mozilla.javascript.tools.shell.Main'
12
12
 
13
13
  program :name, 'JSpec'
14
- program :version, '2.4.2'
14
+ program :version, '2.4.3'
15
15
  program :description, 'JavaScript BDD Testing Framework'
16
16
  default_command :bind
17
17
 
data/jspec.gemspec CHANGED
@@ -2,11 +2,11 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{jspec}
5
- s.version = "2.4.2"
5
+ s.version = "2.4.3"
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-06-30}
9
+ s.date = %q{2009-07-02}
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}
data/lib/jspec.js CHANGED
@@ -5,7 +5,7 @@
5
5
 
6
6
  JSpec = {
7
7
 
8
- version : '2.4.2',
8
+ version : '2.4.3',
9
9
  suites : [],
10
10
  modules : [],
11
11
  allSuites : [],
@@ -428,6 +428,20 @@
428
428
  description : description,
429
429
  assertions : [],
430
430
 
431
+ // Add passing assertion
432
+
433
+ pass : function(message) {
434
+ this.assertions.push({ passed : true, message : message })
435
+ ++JSpec.stats.passes
436
+ },
437
+
438
+ // Add failing assertion
439
+
440
+ fail : function(message) {
441
+ this.assertions.push({ passed : false, message : message })
442
+ ++JSpec.stats.failures
443
+ },
444
+
431
445
  // Run deferred assertions
432
446
 
433
447
  runDeferredAssertions : function() {
@@ -555,7 +569,7 @@
555
569
  * hook return values is returned.
556
570
  *
557
571
  * @param {name} string
558
- * @param {mixed} args ...
572
+ * @param {...} args
559
573
  * @return {array}
560
574
  * @api private
561
575
  */
@@ -780,7 +794,7 @@
780
794
  /**
781
795
  * Convert object(s) to a print-friend string.
782
796
  *
783
- * @param {object, ...} object
797
+ * @param {...} object
784
798
  * @return {string}
785
799
  * @api public
786
800
  */
@@ -1174,8 +1188,8 @@
1174
1188
  replace(/end(?=\s|$)/gm, '});').
1175
1189
  replace(/-\{/g, 'function(){').
1176
1190
  replace(/(\d+)\.\.(\d+)/g, function(_, a, b){ return range(a, b) }).
1177
- replace(/\.should([_\.]not)?[_\.](\w+)(?: |$)(.*)$/gm, '.should$1_$2($3)').
1178
- replace(/([\/\s]*)(.+?)\.(should(?:[_\.]not)?)[_\.](\w+)\((.*)\)$/gm, '$1 expect($2).$3($4, $5)').
1191
+ replace(/\.should([_\.]not)?[_\.](\w+)(?: |;|$)(.*)$/gm, '.should$1_$2($3)').
1192
+ replace(/([\/\s]*)(.+?)\.(should(?:[_\.]not)?)[_\.](\w+)\((.*)\)\s*;?$/gm, '$1 expect($2).$3($4, $5)').
1179
1193
  replace(/, \)/gm, ')').
1180
1194
  replace(/should\.not/gm, 'should_not')
1181
1195
  },
@@ -1259,8 +1273,19 @@
1259
1273
  */
1260
1274
 
1261
1275
  fail : function(message) {
1262
- JSpec.currentSpec.assertions.push({ passed : false, message : message })
1263
- JSpec.stats.failures++
1276
+ JSpec.currentSpec.fail(message)
1277
+ },
1278
+
1279
+
1280
+ /**
1281
+ * Report a passing assertion for the current spec.
1282
+ *
1283
+ * @param {string} message
1284
+ * @api public
1285
+ */
1286
+
1287
+ pass : function(message) {
1288
+ JSpec.currentSpec.pass(message)
1264
1289
  },
1265
1290
 
1266
1291
  /**
@@ -1423,8 +1448,8 @@
1423
1448
 
1424
1449
  var main = this
1425
1450
  var find = JSpec.any
1426
- var utils = 'haveStopped stub hookImmutable hook destub map any last fail range each option inject select error escape \
1427
- extend puts hash query strip color does addMatchers callIterator argumentsToArray'.split(/\s+/)
1451
+ var utils = 'haveStopped stub hookImmutable hook destub map any last pass fail range each option inject select \
1452
+ error escape extend puts hash query strip color does addMatchers callIterator argumentsToArray'.split(/\s+/)
1428
1453
  while (utils.length) util = utils.shift(), eval('var ' + util + ' = JSpec.' + util)
1429
1454
  if (!main.setTimeout) main.setTimeout = function(callback){ callback() }
1430
1455
 
data/spec/spec.grammar.js CHANGED
@@ -16,6 +16,12 @@ describe 'Grammar'
16
16
  true.should.be_true()
17
17
  end
18
18
 
19
+ it 'should allow semicolons'
20
+ true.should.be_true;
21
+ true.should.be_true();
22
+ true.should.be_true() ;
23
+ end
24
+
19
25
  it 'should allow parens to be optional with args'
20
26
  'foobar'.should.include 'foo'
21
27
  'rawr'.should.not_include 'foo'
data/spec/spec.utils.js CHANGED
@@ -1,5 +1,18 @@
1
1
 
2
2
  describe 'Utility'
3
+ describe 'fail()'
4
+ it 'should fail the current spec'
5
+ fail('I failed!')
6
+ end
7
+ end
8
+
9
+ describe 'pass()'
10
+ it 'should pass the current spec'
11
+ pass('yay')
12
+ pass('wahoo')
13
+ end
14
+ end
15
+
3
16
  describe 'stubbing'
4
17
  before_each
5
18
  Object.prototype.stubby = function() { return 'Not stubbed' }
@@ -7,6 +20,10 @@ describe 'Utility'
7
20
  stub(object, 'stubby').and_return('Im stubbed')
8
21
  stub(object, 'toString').and_return('<No im not>')
9
22
  end
23
+
24
+ after_each
25
+ delete Object.prototype.stubby
26
+ end
10
27
 
11
28
  describe 'stub()'
12
29
  it 'should stub :)'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: visionmedia-jspec
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.4.2
4
+ version: 2.4.3
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-06-30 00:00:00 -07:00
12
+ date: 2009-07-02 00:00:00 -07:00
13
13
  default_executable: jspec
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency