visionmedia-jspec 1.1.4 → 1.1.5

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,4 +1,9 @@
1
1
 
2
+ === 1.1.5 / 2009-04-17
3
+
4
+ * Strengthened specs for cascading hooks
5
+ * Fixed cascading hooks
6
+
2
7
  === 1.1.4 / 2009-04-17
3
8
 
4
9
  * Added rhino and server template files
@@ -15,6 +15,7 @@ and much more.
15
15
  * Ruby JavaScript testing server
16
16
  * Nested describes
17
17
  * Does not pollute core object prototypes
18
+ * Cascading before/after/before_each/after_each hooks
18
19
  * Extremely simple and intuitive matcher declaration
19
20
  * Over 45 core matchers
20
21
  * Allows parens to be optional when using matchers to increase readability
data/bin/jspec CHANGED
@@ -10,7 +10,7 @@ require 'fileutils'
10
10
  RHINO = 'java org.mozilla.javascript.tools.shell.Main'
11
11
 
12
12
  program :name, 'JSpec'
13
- program :version, '1.1.4'
13
+ program :version, '1.1.5'
14
14
  program :description, 'JavaScript BDD Testing Framework'
15
15
  default_command :bind
16
16
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{jspec}
5
- s.version = "1.1.4"
5
+ s.version = "1.1.5"
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"]
@@ -5,7 +5,7 @@
5
5
 
6
6
  JSpec = {
7
7
 
8
- version : '1.1.4',
8
+ version : '1.1.5',
9
9
  file : '',
10
10
  suites : [],
11
11
  matchers : {},
@@ -249,6 +249,7 @@
249
249
  // Invoke a hook in context to this suite
250
250
 
251
251
  hook : function(hook) {
252
+ if (this.suite) this.suite.hook(hook)
252
253
  each(this.hooks[hook], function(body) {
253
254
  JSpec.evalBody(body, "Error in hook '" + hook + "', suite '" + this.description + "': ")
254
255
  })
@@ -787,12 +788,12 @@
787
788
  this.runSpec(spec)
788
789
  suite.hook('after_each')
789
790
  })
790
- suite.hook('after')
791
791
  if (suite.hasSuites()) {
792
792
  each(suite.suites, function(suite) {
793
793
  this.runSuite(suite)
794
794
  })
795
795
  }
796
+ suite.hook('after')
796
797
  return this
797
798
  },
798
799
 
@@ -76,55 +76,85 @@ describe 'Grammar'
76
76
  end
77
77
 
78
78
  describe 'before / after blocks'
79
- var n, o
79
+ var n, o, hits = []
80
80
 
81
81
  before
82
82
  n = 1
83
+ hits.push('before')
83
84
  end
84
85
 
85
86
  after
86
87
  n = 0
88
+ hits.push('after')
87
89
  end
88
90
 
89
91
  it 'should work'
90
92
  n.should.eql 1
93
+ hits.should.eql ['before']
91
94
  n++
92
95
  end
93
96
 
94
97
  it 'should persist'
95
98
  n.should.eql 2
99
+ hits.should.eql ['before']
96
100
  end
97
101
 
98
102
  describe 'with nested describe'
99
103
  it 'should be accessable'
100
- n.should.eql 0
104
+ n.should.eql 1
105
+ hits.should.eql ['before', 'before']
101
106
  end
102
107
  end
103
108
  end
104
109
 
105
110
  describe 'before_each / after_each blocks'
111
+ hits = []
112
+
106
113
  before_each
107
114
  n = 1
115
+ hits.push('before_each')
108
116
  end
109
117
 
110
118
  after_each
111
119
  o = 2
120
+ hits.push('after_each')
112
121
  end
113
122
 
114
123
  it 'should work'
115
124
  n.should.eql 1
125
+ hits.should.eql ['before_each']
116
126
  n = 2
117
127
  end
118
128
 
119
129
  it 'should not persist'
120
130
  n.should.eql 1
121
131
  o.should.eql 2
132
+ hits.should.eql ['before_each', 'after_each', 'before_each']
122
133
  end
123
134
 
124
135
  describe 'with nested describe'
125
136
  it 'should be accessable'
126
137
  n.should.eql 1
127
138
  o.should.eql 2
139
+ hits.should.eql ['before_each', 'after_each', 'before_each', 'after_each', 'before_each']
140
+ end
141
+
142
+ it 'should continue hits'
143
+ hits.should.eql ['before_each', 'after_each', 'before_each', 'after_each', 'before_each', 'after_each', 'before_each']
144
+ end
145
+
146
+ describe 'with more hooks'
147
+ before_each
148
+ hits.push('before_each')
149
+ end
150
+
151
+ after_each
152
+ hits.push('after_each')
153
+ end
154
+
155
+ it 'should continue hits, while cascading properly'
156
+ hits.should.eql ['before_each', 'after_each', 'before_each', 'after_each', 'before_each', 'after_each', 'before_each', 'after_each', 'before_each', 'before_each']
157
+ end
128
158
  end
129
159
  end
130
160
  end
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: 1.1.4
4
+ version: 1.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - TJ Holowaychuk