riot 0.12.5 → 0.12.6

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore CHANGED
@@ -8,3 +8,5 @@ _site
8
8
  *.watchr
9
9
  .DS_Store
10
10
  Gemfile.lock
11
+ .rvmrc
12
+
@@ -0,0 +1,10 @@
1
+ language: ruby
2
+ before_install:
3
+ - gem update --system
4
+ - gem --version
5
+ bundler_args: --without development
6
+ rvm:
7
+ - 1.8.7
8
+ - 1.9.2
9
+ - 1.9.3
10
+
data/CHANGELOG CHANGED
@@ -1,328 +1,369 @@
1
- == 0.12.5
1
+ # @markup markdown
2
2
 
3
- ==== Remove doc for some deprecated macros: not, exists, any [charlietanskley]
3
+ # 0.12.6
4
4
 
5
- ==== Deprecate two more macros [charlietanskley]
5
+ * Catch and report on errors that occur while running middleware. Context with error in middleware will not run.
6
+ * Errors that occur during a setup, hookup, or teardown are handled gracefully
7
+ * close #31 - RR seems to carry over some latent varification state between situations
6
8
 
7
- ==== make riot run -w clean. None of those pesky warnings [achiu]
9
+ # 0.12.5
8
10
 
9
- ==== Use #inspect for printing arguments in error results [Mon-Ouie]
11
+ * Remove doc for some deprecated macros: not, exists, any [charlietanskley]
12
+ * Deprecate two more macros [charlietanskley]
13
+ * make riot run -w clean. None of those pesky warnings [achiu]
14
+ * Use #inspect for printing arguments in error results [Mon-Ouie]
15
+ * Move BlankSlate into Riot namespace [Mon-Ouie]
16
+ * Setting options in a sub-context don't leak back into the parent context [skade]
17
+ * Remove deprecated `not!` macro [charlietanksley]
18
+ * Fix all warnings so riot runs `-w` clean
10
19
 
11
- ==== Move BlankSlate into Riot namespace [Mon-Ouie]
20
+ # 0.12.4
12
21
 
13
- ==== Setting options in a sub-context don't leak back into the parent context [skade]
14
-
15
- ==== Remove deprecated `not!` macro [charlietanksley]
16
-
17
- ==== Fix all warnings so riot runs `-w` clean
18
-
19
- == 0.12.4
20
-
21
- ==== Adding Riot.plain! option for not printing output in color [c00lryguy,
22
+ * Adding Riot.plain! option for not printing output in color [c00lryguy,
22
23
  jaknowlden]
23
24
 
24
- == 0.12.3
25
+ # 0.12.3
25
26
 
26
- ==== Going nuts with context helpers: should_not, asserts/denies_topic arguments [achiu]
27
+ * Going nuts with context helpers: should_not, asserts/denies_topic arguments [achiu]
27
28
 
28
29
  This works now: `should_not("do something")` as an alias for `denies`
29
30
 
30
31
  You can now pass arguments to `asserts`, `denies`, `should`, and `should_not`.
31
32
 
32
- context "Playing with hashes" do
33
- setup do
34
- { "foo" => "bar" }
35
- end
33
+ ```
34
+ context "Playing with hashes" do
35
+ setup do
36
+ { "foo" => "bar" }
37
+ end
36
38
 
37
- asserts(:[], "foo").equals("bar")
38
- should(:[], "foo").equals("bar")
39
- denies(:[], "foo").equals("goo")
40
- should_not(:[], "foo").equals("goo")
41
- end # Playing with hashes
39
+ asserts(:[], "foo").equals("bar")
40
+ should(:[], "foo").equals("bar")
41
+ denies(:[], "foo").equals("goo")
42
+ should_not(:[], "foo").equals("goo")
43
+ end # Playing with hashes
44
+ ```
42
45
 
43
- ==== Exit gracefully if a child process exited with failing status [timgaleckas]
46
+ * Exit gracefully if a child process exited with failing status [timgaleckas]
44
47
 
45
48
  No tests will run in this situation.
46
49
 
47
- ==== No status displayed if no tests run [timgaleckas]
48
-
49
- ==== Adding a `denies_topic` macro to Context [Mon-Ouie]
50
-
51
- == 0.12.2
52
-
53
- ==== RDoc'ed the hell out of everything [jaknowlden]
50
+ * No status displayed if no tests run [timgaleckas]
51
+ * Adding a `denies_topic` macro to Context [Mon-Ouie]
54
52
 
55
- ==== Deprecating the not! assertion macro. It may just be gone by 0.13.0 [jaknowlden]
53
+ # 0.12.2
56
54
 
57
- ==== Remove ANSI-color dependency [achiu]
55
+ * RDoc'ed the hell out of everything [jaknowlden]
56
+ * Deprecating the not! assertion macro. It may just be gone by 0.13.0 [jaknowlden]
57
+ * Remove ANSI-color dependency [achiu]
58
+ * Switch from Jeweler to Bundler [achiu]
59
+ * Add PrettyDotMatrixReporter [achiu]
58
60
 
59
- ==== Switch from Jeweler to Bundler [achiu]
61
+ # 0.12.1
60
62
 
61
- ==== Add PrettyDotMatrixReporter [achiu]
63
+ * Error reporting now filters the backtrace to include only meaningful line items. [mbriggs]
64
+ * Added ability to pass method arguments to asserts. [sirupsen]
62
65
 
63
- == 0.12.1
66
+ # 0.12.0
64
67
 
65
- ==== Error reporting now filters the backtrace to include only meaningful line items. [mbriggs]
68
+ * Negative tests are finally here! Added support for `denies` and adjusted macros to care about it with `devaluate`. [jaknowlden, achiu]
66
69
 
67
- ==== Added ability to pass method arguments to asserts. [sirupsen]
70
+ ```
71
+ denies("my name") { "Rumplestiltzkin" }.equals("Henry")
72
+ ```
68
73
 
69
- == 0.12.0
74
+ # 0.11.4
70
75
 
71
- ==== Negative tests are finally here! Added support for `denies` and adjusted macros to care about it with `devaluate`. [jaknowlden, achiu]
72
-
73
- denies("my name") { "Rumplestiltzkin" }.equals("Henry")
74
-
75
- == 0.11.4
76
-
77
- ==== [skade] Passing Proc's instead of lambdas to `instance_eval` to comply with ruby 1.9.2.
78
-
79
- ==== [nu7hatch] Added `describe` alias for `context` for easier rspec porting. Useful at the top level and within a context.
76
+ * [skade] Passing Proc's instead of lambdas to `instance_eval` to comply with ruby 1.9.2.
77
+ * [nu7hatch] Added `describe` alias for `context` for easier rspec porting. Useful at the top level and within a context.
80
78
 
81
79
  Who can argue with porting from rspec to riot? Not me.
82
80
 
83
- describe "My thing" do
84
- asserts(:size).equals(:small)
85
- end # My thing
81
+ ```
82
+ describe "My thing" do
83
+ asserts(:size).equals(:small)
84
+ end # My thing
85
+ ```
86
86
 
87
87
  The following also works:
88
88
 
89
- context "Another thing is"
90
- describe "my" do
91
- asserts_topic.equals("marshmallow") # this test will fail ... because it will ... because it's wrong
92
- end # my
93
- end # Another thing is
89
+ ```
90
+ context "Another thing is"
91
+ describe "my" do
92
+ asserts_topic.equals("marshmallow") # this test will fail ... because it will ... because it's wrong
93
+ end # my
94
+ end # Another thing is
95
+ ```
94
96
 
95
- == 0.11.3
97
+ # 0.11.3
96
98
 
97
- ==== [jaknowlden] Modified `matches` assertion macro to treat actual as a string before executing regular expression comparison.
99
+ * [jaknowlden] Modified `matches` assertion macro to treat actual as a string before executing regular expression comparison.
98
100
 
99
- asserts("a number") { 42 }.matches(/\d+/)
100
- # same as
101
- asserts("a number as string") { "42" }.matches(/\d+/)
101
+ ```
102
+ asserts("a number") { 42 }.matches(/\d+/)
103
+ # same as
104
+ asserts("a number as string") { "42" }.matches(/\d+/)
105
+ ```
102
106
 
103
- == 0.11.2
107
+ # 0.11.2
104
108
 
105
- ==== [jaknowlden] [ISSUE] Options were not nesting. Now fixed.
109
+ * [jaknowlden] [ISSUE] Options were not nesting. Now fixed.
106
110
 
107
- == 0.11.1
111
+ # 0.11.1
108
112
 
109
- ==== [jaknowlden] Middleware can now acts more like you would expect. Middleware now know the next neighbor in the chain and can do stuff to the context before and after the user-defined context is prepared. Removes support for the handle? method. Now we act more like a Rack app.
113
+ * [jaknowlden] Middleware can now acts more like you would expect. Middleware now know the next neighbor in the chain and can do stuff to the context before and after the user-defined context is prepared. Removes support for the handle? method. Now we act more like a Rack app.
110
114
 
111
- class MyMiddleware < Riot::ContextMiddleware
112
- register
113
-
114
- def call(context)
115
- context.setup { "fooberries" }
115
+ ```
116
+ class MyMiddleware < Riot::ContextMiddleware
117
+ register
118
+
119
+ def call(context)
120
+ context.setup { "fooberries" }
116
121
 
117
- middleware.call(context)
122
+ middleware.call(context)
118
123
 
119
- context.hookup { "furberries" } if context.option(:barns)
120
- end
121
- end
124
+ context.hookup { "furberries" } if context.option(:barns)
125
+ end
126
+ end
127
+ ```
122
128
 
123
- == 0.11.0
129
+ # 0.11.0
124
130
 
125
- ==== [jaknowlden] Added option to Context#setup which puts the specific setup block at the beginning of the setups to be called for a context. Also useful for middlewares.
131
+ * [jaknowlden] Added option to Context#setup which puts the specific setup block at the beginning of the setups to be called for a context. Also useful for middlewares.
126
132
 
127
- context "Foo" do
128
- setup { puts "called second" }
129
- setup { puts "called third" }
130
- setup(true) { puts "called first" }
131
- end # Foo
133
+ ```
134
+ context "Foo" do
135
+ setup { puts "called second" }
136
+ setup { puts "called third" }
137
+ setup(true) { puts "called first" }
138
+ end # Foo
139
+ ```
132
140
 
133
- ==== [jaknowlden] Added idea of options for a context. This is another feature picked up from riot-rails work.
141
+ * [jaknowlden] Added idea of options for a context. This is another feature picked up from riot-rails work.
134
142
 
135
143
  Essentially, these are useful for middlewares. For instance, if you wanted to tell a middleware that was looking for a "transactional" option before running code in a transaction block, you might do this:
136
144
 
137
- context User do
138
- set :transactional, true
139
- end # User
145
+ ```
146
+ context User do
147
+ set :transactional, true
148
+ end # User
149
+ ```
140
150
 
141
151
  The middleware might do something with it:
142
152
 
143
- class TransactionalMiddleware < Riot::ContextMiddleware
144
- register
153
+ ```
154
+ class TransactionalMiddleware < Riot::ContextMiddleware
155
+ register
145
156
 
146
- def handle?(context) context.option(:transactional) == true; end
157
+ def handle?(context) context.option(:transactional) == true; end
147
158
 
148
- def prepare(context)
149
- # transactional stuff
150
- end
151
- end # TransactionalMiddleware
159
+ def prepare(context)
160
+ # transactional stuff
161
+ end
162
+ end # TransactionalMiddleware
163
+ ```
152
164
 
153
165
  You can call set as many times as you like
154
166
 
155
- context User do
156
- set :transactional, true
157
- set :foo, :bar
158
- end
167
+ ```
168
+ context User do
169
+ set :transactional, true
170
+ set :foo, :bar
171
+ end
172
+ ```
159
173
 
160
- ==== [jaknowlden] ContextMiddleware: a construction pattern that allows for custom code to be applied to any context given that the middleware chooses to.
174
+ * [jaknowlden] ContextMiddleware: a construction pattern that allows for custom code to be applied to any context given that the middleware chooses to.
161
175
 
162
176
  This is something I started building into riot-rails and decided it was useful enough to just put it into riot itself. If, for instance, you wanted to add a setup with some stuff only if the context description was equal to "Your Mom":
163
177
 
164
- class YourMomMiddleware < Riot::ContextMiddleware
165
- register
166
-
167
- def handle?(context)
168
- context.description == "Your Mom"
169
- end
170
-
171
- def prepare(context)
172
- context.setup do
173
- "your mom is the topic"
174
- end
175
- end
176
- end # YourMomMiddleware
177
-
178
- == 0.10.13
179
-
180
- ==== [jaknowlden] Helpers are now run with other setups, not separately. Which means you could use a helper in a setup.
181
-
182
- context "Foo" do
183
- helper(:user) { User.new }
184
- setup do
185
- Baz.new(:user => user) # :)
186
- end
187
- end # Foo
188
-
189
- ==== [vandrijevik] Correctly report non-RR assertion failures and errors when RR is used.
190
-
191
- context "Foo.bar" do
192
- asserts("baz is called") do
193
- mock(Foo).baz
194
- raise RuntimeError.new("oh noes")
195
- end
196
- end
197
-
198
- would previously return [:fail, "baz() Called 0 times. Expected 1 times."], and will now
199
- correctly return [:error, #<RuntimeError: oh noes>]
200
-
201
- ==== [jaknowlden] Recording description as is. Providing #detailed_description for proper behavior
202
-
203
- foo_context = context(Foo) {}
204
- bar_context = foo_context.context(Bar) {}
205
- bar_context.description
206
- => Bar
207
- bar_context.detailed_description
208
- => "Foo Bar"
209
-
210
- ==== [jaknowlden] No longer assuming topic when no block provided to an assertion. Instead, assuming block fails by default. Use `asserts_topic` only now.
211
-
212
- context "foo" do
213
- setup { "bar" }
214
- asserts_topic.kind_of(String)
215
- asserts("topic").kind_of(String) # Will fail since block returns `false`
216
- asserts("topic").equals(false) # Will actually pass :)
217
- end
218
-
219
- == 0.10.12
220
-
221
- ==== [vandrijevik] Recognizing file and line number of an assertion declaration on failure
178
+ ```
179
+ class YourMomMiddleware < Riot::ContextMiddleware
180
+ register
222
181
 
223
- ==== [vandrijevik,jaknowlden] RR support in Riot
224
-
225
- # teststrap.rb
226
- require 'riot'
227
- require 'riot/rr'
228
-
229
- # your-test.rb
230
- context "foo" do
231
- asserts("failure due to not calling hello") { mock!.hello {"world"} } # actually fails
232
- end
182
+ def handle?(context)
183
+ context.description == "Your Mom"
184
+ end
233
185
 
234
- ==== [jaknowlden] Added Riot::Message to make messages in macros easier to write
235
-
236
- def evaluate(actual, expected)
237
- # ...
238
- expected == actual pass(new_message.received(expected)) ? fail(expected(expected).not(actual))
239
- # ...
186
+ def prepare(context)
187
+ context.setup do
188
+ "your mom is the topic"
240
189
  end
190
+ end
191
+ end # YourMomMiddleware
192
+ ```
193
+
194
+ # 0.10.13
195
+
196
+ * [jaknowlden] Helpers are now run with other setups, not separately. Which means you could use a helper in a setup.
197
+
198
+ ```
199
+ context "Foo" do
200
+ helper(:user) { User.new }
201
+ setup do
202
+ Baz.new(:user => user) # :)
203
+ end
204
+ end # Foo
205
+ ```
206
+
207
+ * [vandrijevik] Correctly report non-RR assertion failures and errors when RR is used.
208
+
209
+ ```
210
+ context "Foo.bar" do
211
+ asserts("baz is called") do
212
+ mock(Foo).baz
213
+ raise RuntimeError.new("oh noes")
214
+ end
215
+ end
216
+ ```
217
+
218
+ would previously return [:fail, "baz() Called 0 times. Expected 1 times."], and will now correctly return [:error, #<RuntimeError: oh noes>]
219
+
220
+ * [jaknowlden] Recording description as is. Providing #detailed_description for proper behavior
221
+
222
+ ```
223
+ foo_context = context(Foo) {}
224
+ bar_context = foo_context.context(Bar) {}
225
+ bar_context.description
226
+ => Bar
227
+ bar_context.detailed_description
228
+ => "Foo Bar"
229
+ ```
230
+
231
+ * [jaknowlden] No longer assuming topic when no block provided to an assertion. Instead, assuming block fails by default. Use `asserts_topic` only now.
232
+
233
+ ```
234
+ context "foo" do
235
+ setup { "bar" }
236
+ asserts_topic.kind_of(String)
237
+ asserts("topic").kind_of(String) # Will fail since block returns `false`
238
+ asserts("topic").equals(false) # Will actually pass :)
239
+ end
240
+ ```
241
+
242
+ # 0.10.12
243
+
244
+ * [vandrijevik] Recognizing file and line number of an assertion declaration on failure
245
+ * [vandrijevik,jaknowlden] RR support in Riot
246
+
247
+ ```
248
+ # teststrap.rb
249
+ require 'riot'
250
+ require 'riot/rr'
251
+
252
+ # your-test.rb
253
+ context "foo" do
254
+ asserts("failure due to not calling hello") { mock!.hello {"world"} } # actually fails
255
+ end
256
+ ```
257
+
258
+ * [jaknowlden] Added Riot::Message to make messages in macros easier to write
259
+
260
+ ```
261
+ def evaluate(actual, expected)
262
+ # ...
263
+ expected == actual pass(new_message.received(expected)) ? fail(expected(expected).not(actual))
264
+ # ...
265
+ end
266
+ ```
267
+
268
+ * [jaknowlden] Added responds_to as a respond_to alias
269
+ * [jaknowlden] Added the equivalent_to macro to compare case equality (===). equals is now (==)
270
+ * [jaknowlden] Assuming RootContext if nil parent provided. Added Context#parent to the API
271
+
272
+ ```
273
+ Riot::Context.new("Hi", nil) {}.parent.class
274
+ => Riot::RootContext
275
+ ```
276
+
277
+ # 0.10.11
278
+
279
+ * [gabrielg, jaknowlden] Context#asserts_topic now takes an optional description
280
+
281
+ ```
282
+ asserts_topic.exists
283
+ asserts_topic("some kind of description").exists
284
+ ```
285
+
286
+ * [gabrielg, jaknowlden] Added not! assertion macro
287
+
288
+ ```
289
+ setup { User.new(:funny? => false) }
290
+ asserts(:funny?).not!
291
+ ```
241
292
 
242
- ==== [jaknowlden] Added responds_to as a respond_to alias
293
+ * [jaknowlden] Added Context#hookup to add some setup code to an already defined topic
294
+
295
+ ```
296
+ context "yo mama" do
297
+ setup { YoMama.new }
298
+ # ...
299
+ context "is cool" do
300
+ hookup { topic.do_something_involving_state }
301
+ asserts_topic.kind_of?(YoMama)
302
+ end
303
+ end
304
+ ```
243
305
 
244
- ==== [jaknowlden] Added the equivalent_to macro to compare case equality (===). equals is now (==)
306
+ * [jaknowlden] Added Riot.alone! mode to ensure Riot.run is not run at-exit
307
+
308
+ ```
309
+ Riot.alone!
310
+ Riot.run
311
+ ```
245
312
 
246
- ==== [jaknowlden] Assuming RootContext if nil parent provided. Added Context#parent to the API
313
+ This will still print output unless you also Riot.silently!
247
314
 
248
- Riot::Context.new("Hi", nil) {}.parent.class
249
- => Riot::RootContext
315
+ * [gabrielg, jaknowlden] Returning non-zero status at-exit when tests don't pass
250
316
 
251
- == 0.10.11
317
+ # 0.10.10
252
318
 
253
- ==== [gabrielg, jaknowlden] Context#asserts_topic now takes an optional description
254
-
255
- asserts_topic.exists
256
- asserts_topic("some kind of description").exists
257
-
258
- ==== [gabrielg, jaknowlden] Added not! assertion macro
259
-
260
- setup { User.new(:funny? => false) }
261
- asserts(:funny?).not!
262
-
263
- ==== [jaknowlden] Added Context#hookup to add some setup code to an already defined topic
264
-
265
- context "yo mama" do
266
- setup { YoMama.new }
267
- # ...
268
- context "is cool" do
269
- hookup { topic.do_something_involving_state }
270
- asserts_topic.kind_of?(YoMama)
271
- end
272
- end
319
+ * [dasch, jaknowlden] Passing assertion macros can now return a custom message
273
320
 
274
- ==== [jaknowlden] Added Riot.alone! mode to ensure Riot.run is not run at-exit
321
+ ```
322
+ def evaluate(actual, *expectings)
323
+ 1 == 1 ? pass("1 does equal 1") : fail("1 does not equal 1 in this universe")
324
+ end
325
+ ```
275
326
 
276
- Riot.alone!
277
- Riot.run
327
+ * [jaknowlden] Removing Context#extend_assertions and related code
328
+ * [dasch] Allow the use of symbolic descriptions as shorthands for sending the message to the topic
278
329
 
279
- This will still print output unless you also Riot.silently!
330
+ ```
331
+ setup { "foo" }
332
+ asserts(:upcase).equals("FOO")
333
+ ```
280
334
 
281
- ==== [gabrielg, jaknowlden] Returning non-zero status at-exit when tests don't pass
335
+ * [jaknowlden, splattael] Added AssertionMacro and #register for macros
282
336
 
283
- == 0.10.10
284
-
285
- ==== [dasch, jaknowlden] Passing assertion macros can now return a custom message
337
+ ```
338
+ module My
339
+ class CustomThingAssertion < Riot::AssertionMacro
340
+ register :custom_thing
341
+ expects_exception!
286
342
 
287
343
  def evaluate(actual, *expectings)
288
- 1 == 1 ? pass("1 does equal 1") : fail("1 does not equal 1 in this universe")
289
- end
290
-
291
- ==== [jaknowlden] Removing Context#extend_assertions and related code
292
-
293
- ==== [dasch] Allow the use of symbolic descriptions as shorthands for sending the message to the topic
294
-
295
- setup { "foo" }
296
- asserts(:upcase).equals("FOO")
297
-
298
- ==== [jaknowlden, splattael] Added AssertionMacro and #register for macros
299
-
300
- module My
301
- class CustomThingAssertion < Riot::AssertionMacro
302
- register :custom_thing
303
- expects_exception!
304
-
305
- def evaluate(actual, *expectings)
306
- # ...
307
- end
308
- end
309
-
310
- Riot::Assertion.register_macro :custom_thing, CustomThingAssertion
311
- end
312
-
313
- ==== [splattael] Replace IOReporter#say with #puts. Also add #print.
314
-
315
- class SomeNewReporter < IOReporter
316
- def pass
317
- puts "I PASSED"
318
- end
319
-
320
- def fail
321
- print "F"
322
- end
323
344
  # ...
324
345
  end
325
-
326
- == 0.10.9 and before
346
+ end
347
+
348
+ Riot::Assertion.register_macro :custom_thing, CustomThingAssertion
349
+ end
350
+ ```
351
+
352
+ * [splattael] Replace IOReporter#say with #puts. Also add #print.
353
+
354
+ ```
355
+ class SomeNewReporter < IOReporter
356
+ def pass
357
+ puts "I PASSED"
358
+ end
359
+
360
+ def fail
361
+ print "F"
362
+ end
363
+ # ...
364
+ end
365
+ ```
366
+
367
+ # 0.10.9 and before
327
368
 
328
369
  See the commit log: http://github.com/thumblemonks/riot/commits/master