mac_bacon 1.1.21

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/COPYING ADDED
@@ -0,0 +1,18 @@
1
+ Copyright (c) 2007, 2008 Christian Neukirchen <purl.org/net/chneukirchen>
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy
4
+ of this software and associated documentation files (the "Software"), to
5
+ deal in the Software without restriction, including without limitation the
6
+ rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
7
+ sell copies of the Software, and to permit persons to whom the Software is
8
+ furnished to do so, subject to the following conditions:
9
+
10
+ The above copyright notice and this permission notice shall be included in
11
+ all copies or substantial portions of the Software.
12
+
13
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
16
+ THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
17
+ IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
18
+ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/ChangeLog ADDED
@@ -0,0 +1,272 @@
1
+ Mon Jan 10 22:43:37 2011 +0100 Eloy Duran <eloy.de.enige@gmail.com>
2
+ * Create MacBacon fork that works in a NSRunloop based environment. I.e. MacRuby/Objectove-C.
3
+
4
+ Wed Apr 14 05:40:31 2010 -0400 Gabriel Horner <gabriel.horner@gmail.com>
5
+ * Indent nested contexts for SpecDoxOutput
6
+ Based on similar patch from http://github.com/wvl/bacon/commit/af940dbeb789f5eef2d998e227e5425d
7
+
8
+ Mon Mar 29 14:06:47 2010 +0200 Christian Neukirchen <chneukirchen@gmail.com>
9
+ * Merge remote branch 'cldwalker/timer'
10
+
11
+ Sun Mar 28 23:16:49 2010 -0400 Gabriel Horner <gabriel.horner@gmail.com>
12
+ * give TestUnitOutput the same timer that Test::Unit has
13
+
14
+ Sat Mar 20 04:19:18 2010 -0400 Gabriel Horner <gabriel.horner@gmail.com>
15
+ * methods in a context should serve as behavior that is inherited by sibling contexts
16
+
17
+ Sun Jan 17 12:17:42 2010 -0800 Eoin Hennessy <eoin@randomrules.org>
18
+ * Add support for finding specs with RSpec style naming.
19
+
20
+ Tue Sep 22 21:17:55 2009 +0200 Christian Neukirchen <chneukirchen@gmail.com>
21
+ * Add ChangeLog as gem dependency
22
+ reported by lian
23
+
24
+ Mon Aug 31 23:36:56 2009 +0200 Eloy Duran <eloy.de.enige@gmail.com>
25
+ * Revert old change that was made because 1.9.0 couldn't rescue a splatted array of Exception classes. MacRuby currently can't use when with the same array and 1.9.2dev does.
26
+
27
+ Also some other minor changes which didn't work currently on 1.9.2dev, but are nicer anyway imo.
28
+
29
+ Thu Jan 22 06:07:53 2009 +0000 Anna Gabutero <amdg@lavabit.com>
30
+ * Add libs to include path when invoking Test::Unit
31
+
32
+ Sun Jan 11 14:41:01 2009 +0100 Christian Neukirchen <chneukirchen@gmail.com>
33
+ * Update homepage
34
+
35
+ Sat Jan 10 14:01:30 2009 -0800 Christian Neukirchen <chneukirchen@gmail.com>
36
+ * Allow negated nontrue values outside specs
37
+
38
+ Sat Jan 10 13:44:14 2009 -0800 Ian Dees <undees@gmail.com>
39
+ * Added test for nontrue values outside specs
40
+
41
+ Sun Nov 30 11:14:31 2008 +0100 Christian Neukirchen <chneukirchen@gmail.com>
42
+ * Push VERSION to 1.1
43
+
44
+ Sun Nov 30 11:13:33 2008 +0100 Christian Neukirchen <chneukirchen@gmail.com>
45
+ * Last fixes
46
+
47
+ Sun Nov 30 11:06:09 2008 +0100 Christian Neukirchen <chneukirchen@gmail.com>
48
+ * Update README
49
+
50
+ Sun Nov 30 11:00:28 2008 +0100 Christian Neukirchen <chneukirchen@gmail.com>
51
+ * Add Knock output
52
+
53
+ Sat Oct 25 12:30:00 2008 +0200 Christian Neukirchen <chneukirchen@gmail.com>
54
+ * De-metaprogram and document nested before/after
55
+
56
+ Fri Oct 24 17:20:17 2008 -0500 Yossef Mendelssohn <ymendel@pobox.com>
57
+ * Having higher-level after blocks also be run for nested contexts.
58
+
59
+ Fri Oct 24 17:14:30 2008 -0500 Yossef Mendelssohn <ymendel@pobox.com>
60
+ * Cleaning up setting of nested before blocks
61
+
62
+ Fri Oct 24 17:09:42 2008 -0500 Yossef Mendelssohn <ymendel@pobox.com>
63
+ * Ensuring that nested before blocks are run in the correct order
64
+
65
+ Fri Oct 24 17:06:18 2008 -0500 Yossef Mendelssohn <ymendel@pobox.com>
66
+ * Ensuring that before blocks don't bleed into sibling levels
67
+
68
+ Fri Oct 24 17:01:51 2008 -0500 Yossef Mendelssohn <ymendel@pobox.com>
69
+ * Letting before blocks be run from higher levels in nested context
70
+
71
+ Split up Context#initialize to let running be a separate step.
72
+ Added attr_reader for Context name and block to let the running step have access
73
+ to them without resorting to instance variables.
74
+
75
+ Sat Oct 4 13:38:23 2008 +0200 Christian Neukirchen <chneukirchen@gmail.com>
76
+ * Move to git
77
+
78
+ Sun Aug 17 13:32:40 2008 +0200 Christian Neukirchen <chneukirchen@gmail.com>
79
+ * Add option to disable backtraces
80
+
81
+ Sun Aug 17 12:48:29 2008 +0200 Christian Neukirchen <chneukirchen@gmail.com>
82
+ * Don't %-expand twice in TAP output
83
+
84
+ Fri Aug 1 12:01:28 2008 +0200 jftucker <jftucker@gmail.com>
85
+ * pols-for-at-exit
86
+
87
+ Added an alias for summary_on_exit to summary_at_exit to save on POLS for some people (me!).
88
+
89
+ Sun Jul 6 18:47:42 2008 +0200 Christian Neukirchen <chneukirchen@gmail.com>
90
+ * Add bacon_rspec.rb to avoid errors when .bacon doesn't exist
91
+
92
+ Sun Jul 6 18:05:13 2008 +0200 Christian Neukirchen <chneukirchen@gmail.com>
93
+ * Push VERSION to 1.0
94
+
95
+ Sun Jul 6 18:04:55 2008 +0200 Christian Neukirchen <chneukirchen@gmail.com>
96
+ * Small reformatting
97
+
98
+ Sun Jul 6 18:04:41 2008 +0200 Christian Neukirchen <chneukirchen@gmail.com>
99
+ * Update README
100
+
101
+ Sun Jul 6 18:03:51 2008 +0200 Christian Neukirchen <chneukirchen@gmail.com>
102
+ * Allow 50 lines more code
103
+
104
+ Sun Jul 6 17:46:07 2008 +0200 Christian Neukirchen <chneukirchen@gmail.com>
105
+ * Suppress warnings when the suite loads Bacon again
106
+
107
+ Wed Jun 25 13:56:34 2008 +0200 jftucker <jftucker@gmail.com>
108
+ * support spec/test subdirs for -a
109
+
110
+ Wed Jun 25 13:20:29 2008 +0200 jftucker <jftucker@gmail.com>
111
+ * support mappings for subdirs in autotest
112
+
113
+ Wed Jun 25 00:27:08 2008 +0200 jftucker <jftucker@gmail.com>
114
+ * adding autotest support
115
+
116
+ The autotest auto discovery uses bacons test/unit output.
117
+ It does not currently call specific examples (TODO).
118
+ It currently attempts to fix the rspec auto discovery by removing it if it
119
+ finds a .bacon under test/ or spec/. In fact, these are the only conditions
120
+ under which the bacon autotest will load.
121
+
122
+ Thu Mar 13 04:00:42 2008 +0100 Michael Fellinger m.fellinger@gmail.com <chneukirchen@gmail.com>
123
+ * Show exception instead of missing error if a spec is empty because of it.
124
+
125
+ Sun Mar 2 11:52:38 2008 +0100 Christian Neukirchen <chneukirchen@gmail.com>
126
+ * Call after-blocks even if before-blocks or spec raise exceptions
127
+
128
+ Based on a patch by Keita Yamaguchi
129
+
130
+ Sun Mar 2 11:52:09 2008 +0100 Christian Neukirchen <chneukirchen@gmail.com>
131
+ * Count failed requirements too
132
+
133
+ Sun Feb 10 18:45:24 2008 +0100 Christian Neukirchen <chneukirchen@gmail.com>
134
+ * Reformats
135
+
136
+ Sun Feb 10 18:42:32 2008 +0100 Christian Neukirchen <chneukirchen@gmail.com>
137
+ * Empty specifications are now erroneous
138
+
139
+ Sun Feb 10 14:49:58 2008 +0100 Michael Fellinger <m.fellinger@gmail.com>
140
+ * Improve require for lib/bacon
141
+
142
+ Wed Jan 23 23:59:40 2008 +0100 rff.rff <rff.rff@gmail.com>
143
+ * allows multiple arguments to #describe to allow specialized behaviours such as
144
+
145
+ describe Queue,'empty'
146
+ describe Queue,'full'
147
+
148
+ Some tests for this and manveru's latest patch are included
149
+
150
+ Sat Jan 19 23:07:25 2008 +0100 Michael Fellinger <m.fellinger@gmail.com>
151
+ * #to_s the argument to describe
152
+
153
+ Fri Jan 18 15:25:27 2008 +0100 Christian Neukirchen <chneukirchen@gmail.com>
154
+ * Flunk if there are no arguments to #it
155
+
156
+ Mon Jan 14 01:34:44 2008 +0100 rff.rff <rff.rff@gmail.com>
157
+ * add should('foo') shortcut for it('should foo')
158
+
159
+ Mon Jan 7 20:24:04 2008 +0100 Christian Neukirchen <chneukirchen@gmail.com>
160
+ * Last minute
161
+
162
+ Mon Jan 7 20:21:43 2008 +0100 Christian Neukirchen <chneukirchen@gmail.com>
163
+ * Update copyright
164
+
165
+ Mon Jan 7 20:08:40 2008 +0100 Christian Neukirchen <chneukirchen@gmail.com>
166
+ * Tighten code
167
+
168
+ Mon Jan 7 19:33:39 2008 +0100 Christian Neukirchen <chneukirchen@gmail.com>
169
+ * Update README
170
+
171
+ Mon Jan 7 19:33:25 2008 +0100 Christian Neukirchen <chneukirchen@gmail.com>
172
+ * Add bacon -o FORMAT
173
+
174
+ Mon Jan 7 19:33:07 2008 +0100 Christian Neukirchen <chneukirchen@gmail.com>
175
+ * Improve TAP output
176
+
177
+ Mon Dec 31 19:01:49 2007 +0100 Michael Fellinger <m.fellinger@gmail.com>
178
+ * behaves_like should take multiple names
179
+
180
+ Sun Dec 30 19:38:18 2007 +0100 Michael Fellinger <m.fellinger@gmail.com>
181
+ * Adding Proc#change? to check for changes on repeated calling of proc.
182
+
183
+ Fri Dec 28 12:42:04 2007 +0100 Michael Fellinger <m.fellinger@gmail.com>
184
+ * Patching for ruby 1.9.0 and removing useless spaces
185
+
186
+ Wed Dec 5 14:56:51 2007 +0100 Christian Neukirchen <chneukirchen@gmail.com>
187
+ * Make code nicer
188
+
189
+ Wed Dec 5 14:48:06 2007 +0100 Christian Neukirchen <chneukirchen@gmail.com>
190
+ * Fix Rakefile
191
+
192
+ Wed Dec 5 14:46:32 2007 +0100 Christian Neukirchen <chneukirchen@gmail.com>
193
+ * Integrate Rakefile
194
+
195
+ Wed Dec 5 14:43:26 2007 +0100 Christian Neukirchen <chneukirchen@gmail.com>
196
+ * Add Rakefile
197
+
198
+ Wed Dec 5 14:41:53 2007 +0100 Christian Neukirchen <chneukirchen@gmail.com>
199
+ * Add README
200
+
201
+ Wed Dec 5 14:41:26 2007 +0100 Christian Neukirchen <chneukirchen@gmail.com>
202
+ * Add copyright
203
+
204
+ Wed Dec 5 14:18:54 2007 +0100 Christian Neukirchen <chneukirchen@gmail.com>
205
+ * Move #close? to Numeric
206
+
207
+ Wed Dec 5 14:11:34 2007 +0100 Christian Neukirchen <chneukirchen@gmail.com>
208
+ * Add flunking
209
+
210
+ Wed Dec 5 13:42:13 2007 +0100 Christian Neukirchen <chneukirchen@gmail.com>
211
+ * Allow using Object#should outside of contexts providing boolean return
212
+
213
+ Wed Dec 5 13:41:00 2007 +0100 Christian Neukirchen <chneukirchen@gmail.com>
214
+ * Move summary outputter to lib/bacon.rb
215
+
216
+ Wed Dec 5 13:26:27 2007 +0100 Christian Neukirchen <chneukirchen@gmail.com>
217
+ * Fix output of summary
218
+
219
+ Wed Dec 5 13:26:16 2007 +0100 Christian Neukirchen <chneukirchen@gmail.com>
220
+ * Add identical_to/same_as
221
+
222
+ Wed Dec 5 02:12:24 2007 +0100 Christian Neukirchen <chneukirchen@gmail.com>
223
+ * Remove debugging statements
224
+
225
+ Wed Dec 5 02:00:03 2007 +0100 Christian Neukirchen <chneukirchen@gmail.com>
226
+ * Refactor tests
227
+
228
+ Wed Dec 5 01:58:08 2007 +0100 Christian Neukirchen <chneukirchen@gmail.com>
229
+ * Test Context#should.{throw,raise}
230
+
231
+ Wed Dec 5 01:56:29 2007 +0100 Christian Neukirchen <chneukirchen@gmail.com>
232
+ * Add should.throw
233
+
234
+ Wed Dec 5 01:49:33 2007 +0100 Christian Neukirchen <chneukirchen@gmail.com>
235
+ * Implement -n and -t for filtering on context/specification names
236
+
237
+ Wed Dec 5 01:41:56 2007 +0100 Christian Neukirchen <chneukirchen@gmail.com>
238
+ * Add shared contexts
239
+
240
+ Wed Dec 5 01:41:39 2007 +0100 Christian Neukirchen <chneukirchen@gmail.com>
241
+ * Make directives belong to Kernel and private
242
+
243
+ Wed Dec 5 01:41:17 2007 +0100 Christian Neukirchen <chneukirchen@gmail.com>
244
+ * Clear up error reporting
245
+
246
+ Wed Dec 5 01:23:27 2007 +0100 Christian Neukirchen <chneukirchen@gmail.com>
247
+ * Add TAP generator
248
+
249
+ Thu May 31 14:32:48 2007 +0200 Christian Neukirchen <chneukirchen@gmail.com>
250
+ * Set correct $?
251
+
252
+ Thu May 31 14:28:35 2007 +0200 Christian Neukirchen <chneukirchen@gmail.com>
253
+ * Add Test::Unit-like output (-q)
254
+
255
+ Thu May 31 14:18:00 2007 +0200 Christian Neukirchen <chneukirchen@gmail.com>
256
+ * Add standalone runner, bin/bacon
257
+
258
+ Thu May 31 14:17:40 2007 +0200 Christian Neukirchen <chneukirchen@gmail.com>
259
+ * Import test-suite
260
+
261
+ Thu May 31 14:17:05 2007 +0200 Christian Neukirchen <chneukirchen@gmail.com>
262
+ * Fix for testsuite
263
+
264
+ Thu May 31 14:16:25 2007 +0200 Christian Neukirchen <chneukirchen@gmail.com>
265
+ * Fix output
266
+
267
+ Wed May 30 17:50:23 2007 +0200 Christian Neukirchen <chneukirchen��@gmail.com>
268
+ * Externalize spec/req handling
269
+
270
+ Wed May 30 17:32:15 2007 +0200 Christian Neukirchen <chneukirchen��@gmail.com>
271
+ * Import Bacon, a small spec framework
272
+
data/RDOX ADDED
@@ -0,0 +1,96 @@
1
+ Bacon
2
+ - should have should.satisfy
3
+ - should have should.equal
4
+ - should have should.raise
5
+ - should have should.raise with a block
6
+ - should have a should.raise should return the exception
7
+ - should have should.be.an.instance_of
8
+ - should have should.be.nil
9
+ - should have should.include
10
+ - should have should.be.a.kind_of
11
+ - should have should.match
12
+ - should have should.not.raise
13
+ - should have should.throw
14
+ - should have should.not.satisfy
15
+ - should have should.not.equal
16
+ - should have should.not.match
17
+ - should have should.be.identical_to/same_as
18
+ - should have should.respond_to
19
+ - should have should.be.close [FAILED]
20
+ - should support multiple negation
21
+ - should have should.<predicate>
22
+ - should have should <operator> (>, >=, <, <=, ===)
23
+ - should allow for custom shoulds
24
+ - should have should.flunk
25
+
26
+ before/after
27
+ - should run in the right order
28
+ - should not run from lower level
29
+
30
+ when nested
31
+ - should run from higher level
32
+ - should run at the nested level
33
+ - should run in the right order
34
+
35
+ when nested at a sibling level
36
+ - should not run from sibling level
37
+
38
+ shared/behaves_like
39
+ - gets called where it is included
40
+ - raises NameError when the context is not found
41
+ - gets called where it is included
42
+ - can access data
43
+
44
+ Methods
45
+ - should be accessible in a test
46
+
47
+ when in a sibling context
48
+ - should be accessible in a test
49
+
50
+ describe arguments
51
+ - should work with string
52
+ - should work with symbols
53
+ - should work with modules
54
+ - should work with namespaced modules
55
+ - should work with multiple arguments
56
+
57
+ NSRunloop aware Bacon
58
+ - allows the user to postpone execution of a block for n seconds, which will halt any further execution of specs
59
+
60
+ A non-true value
61
+ - should pass negated tests inside specs
62
+ - should pass negated tests outside specs
63
+
64
+ #should shortcut for #it('should')
65
+ - should be called
66
+ - should save some characters by typing should
67
+ - should save characters even on failure
68
+ - should work nested
69
+ - should add new specifications
70
+ - should have been called
71
+
72
+ string
73
+
74
+ behaviour
75
+
76
+ Bacon
77
+
78
+ Bacon::Context
79
+
80
+ Bacon::Context empty
81
+
82
+ Bacon::Error: not #<Proc:0x20055dc20 (lambda)>.raise?(Bacon::Error) failed
83
+ /Users/eloy/Documents/DEVELOPMENT/MacBacon/lib/mac_bacon.rb:425:in `satisfy': Bacon - should have should.be.close
84
+ /Users/eloy/Documents/DEVELOPMENT/MacBacon/lib/mac_bacon.rb:439:in `method_missing:'
85
+ /Users/eloy/Documents/DEVELOPMENT/MacBacon/test/spec_bacon.rb:9:in `block'
86
+ /Users/eloy/Documents/DEVELOPMENT/MacBacon/lib/mac_bacon.rb:422:in `satisfy'
87
+ /Users/eloy/Documents/DEVELOPMENT/MacBacon/lib/mac_bacon.rb:408:in `an:'
88
+ /Users/eloy/Documents/DEVELOPMENT/MacBacon/lib/mac_bacon.rb:374:in `should:'
89
+ /Users/eloy/Documents/DEVELOPMENT/MacBacon/test/spec_bacon.rb:182:in `block'
90
+ /Users/eloy/Documents/DEVELOPMENT/MacBacon/lib/mac_bacon.rb:157:in `block'
91
+ /Users/eloy/Documents/DEVELOPMENT/MacBacon/lib/mac_bacon.rb:194:in `execute_block'
92
+ /Users/eloy/Documents/DEVELOPMENT/MacBacon/lib/mac_bacon.rb:153:in `run'
93
+ /Users/eloy/Documents/DEVELOPMENT/MacBacon/lib/mac_bacon.rb:233:in `run'
94
+ /Users/eloy/Documents/DEVELOPMENT/MacBacon/bin/macbacon:118:in `<main>'
95
+
96
+ 49 specifications (375 requirements), 1 failures, 0 errors
data/README ADDED
@@ -0,0 +1,324 @@
1
+ = MacBacon -- small RSpec clone.
2
+
3
+ "Truth will sooner come out from error than from confusion."
4
+ ---Francis Bacon
5
+
6
+ Bacon is a small RSpec clone weighing less than 350 LoC but
7
+ nevertheless providing all essential features.
8
+
9
+ This MacBacon fork is created and maintained by Eloy Durán (@alloy).
10
+ It differs with regular Bacon in that it operates properly in a
11
+ NSRunloop based environment. I.e. MacRuby/Objective-C. See the
12
+ paragraph about the `wait` command for more info.
13
+
14
+ == Whirl-wind tour
15
+
16
+ require 'mac_bacon'
17
+
18
+ describe 'A new array' do
19
+ before do
20
+ @ary = Array.new
21
+ end
22
+
23
+ it 'should be empty' do
24
+ @ary.should.be.empty
25
+ @ary.should.not.include 1
26
+ end
27
+
28
+ it 'should have zero size' do
29
+ @ary.size.should.equal 0
30
+ @ary.size.should.be.close 0.1, 0.5
31
+ end
32
+
33
+ it 'should raise on trying fetch any index' do
34
+ lambda { @ary.fetch 0 }.
35
+ should.raise(IndexError).
36
+ message.should.match(/out of array/)
37
+
38
+ # Alternatively:
39
+ should.raise(IndexError) { @ary.fetch 0 }
40
+ end
41
+
42
+ it 'should have an object identity' do
43
+ @ary.should.not.be.same_as Array.new
44
+ end
45
+
46
+ it 'should perform a long running operation' do
47
+ @ary.performSelector("addObject:", withObject:"soup", afterDelay:0.5)
48
+ wait 0.6 do
49
+ @ary.size.should.be 1
50
+ end
51
+ end
52
+
53
+ # Custom assertions are trivial to do, they are lambdas returning a
54
+ # boolean vale:
55
+ palindrome = lambda { |obj| obj == obj.reverse }
56
+ it 'should be a palindrome' do
57
+ @ary.should.be.a palindrome
58
+ end
59
+
60
+ it 'should have super powers' do
61
+ should.flunk "no super powers found"
62
+ end
63
+ end
64
+
65
+ Now run it:
66
+
67
+ $ macbacon whirlwind.rb
68
+ A new array
69
+ - should be empty
70
+ - should have zero size
71
+ - should raise on trying fetch any index
72
+ - should have an object identity
73
+ - should perform a long running operation
74
+ - should be a palindrome
75
+ - should have super powers [MISSING]
76
+
77
+ Bacon::Error: no super powers found
78
+ ./whirlwind.rb:44:in `block': A new array - should have super powers
79
+
80
+ Bacon::Error: empty specification: A new array should have super powers
81
+
82
+ 7 specifications (10 requirements), 1 failures, 0 errors
83
+
84
+ If you want shorter output, use the Test::Unit format:
85
+
86
+ $ macbacon -q whirlwind.rb
87
+ ......F
88
+ Bacon::Error: no super powers found
89
+ ./whirlwind.rb:39: A new array - should have super powers
90
+ ./whirlwind.rb:38
91
+ ./whirlwind.rb:3
92
+
93
+ 7 tests, 10 assertions, 1 failures, 0 errors
94
+
95
+ It also supports TAP:
96
+
97
+ $ macbacon -p whirlwind.rb
98
+ ok 1 - should be empty
99
+ ok 2 - should have zero size
100
+ ok 3 - should raise on trying fetch any index
101
+ ok 4 - should have an object identity
102
+ ok 5 - should be a palindrome
103
+ ok 6 - should perform a long running operation
104
+ not ok 7 - should have super powers: FAILED
105
+ # Bacon::Error: no super powers found
106
+ # ./whirlwind.rb:44: A new array - should have super powers
107
+ 1..7
108
+ # 7 tests, 10 assertions, 1 failures, 0 errors
109
+
110
+ $ macbacon -p whirlwind.rb | taptap -q
111
+ Tests took 0.00 seconds.
112
+ FAILED tests 7
113
+ 7) should have super powers: FAILED
114
+
115
+ Failed 1/7 tests, 83.33% okay.
116
+
117
+ (taptap is available from http://chneukirchen.org/repos/taptap/)
118
+
119
+ As of Bacon 1.1, it also supports Knock:
120
+
121
+ $ macbacon -k whirlwind.rb
122
+ ok - should be empty
123
+ ok - should have zero size
124
+ ok - should raise on trying fetch any index
125
+ ok - should have an object identity
126
+ ok - should be a palindrome
127
+ ok - should perform a long running operation
128
+ not ok - should have super powers: FAILED
129
+ # Bacon::Error: no super powers found
130
+ # ./whirlwind.rb:4: A new array - should have super powers
131
+
132
+ $ bacon -k whirlwind.rb | kn-sum
133
+ 7 tests, 1 failed (83.3333% succeeded)
134
+
135
+ (knock is available from http://github.com/chneukirchen/knock/)
136
+
137
+
138
+ == Implemented assertions
139
+
140
+ * should.<predicate> and should.be.<predicate>
141
+ * should.equal
142
+ * should.match
143
+ * should.be.identical_to / should.be.same_as
144
+ * should.raise(*exceptions) { }
145
+ * should.change { }
146
+ * should.throw(symbol) { }
147
+ * should.satisfy { |object| }
148
+
149
+
150
+ == Added core predicates
151
+
152
+ * Object#true?
153
+ * Object#false?
154
+ * Proc#change?
155
+ * Proc#raise?
156
+ * Proc#throw?
157
+ * Numeric#close?
158
+
159
+
160
+ == before/after
161
+
162
+ before and after need to be defined before the first specification in
163
+ a context and are run before and after each specification.
164
+
165
+ As of Bacon 1.1, before and after do nest in nested contexts.
166
+
167
+
168
+ == Shared contexts
169
+
170
+ You can define shared contexts in Bacon like this:
171
+
172
+ shared "an empty container" do
173
+ it "should have size zero" do
174
+ end
175
+
176
+ it "should be empty" do
177
+ end
178
+ end
179
+
180
+ context "A new array" do
181
+ behaves_like "an empty container"
182
+ end
183
+
184
+ These contexts are not executed on their own, but can be included with
185
+ behaves_like in other contexts. You can use shared contexts to
186
+ structure suites with many recurring specifications.
187
+
188
+
189
+ == Matchers
190
+
191
+ Custom matchers are simply lambdas returning a boolean value, for
192
+ example:
193
+
194
+ def shorter_than(max_size)
195
+ lambda { |obj| obj.size < max_size }
196
+ end
197
+
198
+ [1,2,3].should.be shorter_than(5)
199
+
200
+ You can use modules and extend to group matchers for use in multiple
201
+ contexts.
202
+
203
+
204
+ == wait
205
+
206
+ Often in Objective-C apps, code will *not* execute immediately, but
207
+ scheduled on a runloop for later execution. Therefor a mechanism is
208
+ needed that will postpone execution of some assertions for a period of
209
+ time. This is where the `wait` macro comes in:
210
+
211
+ it 'should perform a long running operation' do
212
+ # Here a method call is scheduled to be performed ~0.5 seconds in the future
213
+ @ary.performSelector("addObject:", withObject:"soup", afterDelay:0.5)
214
+ wait 0.6 do
215
+ # This block is executed ~0.6 seconds in the future
216
+ @ary.size.should.be 1
217
+ end
218
+ end
219
+
220
+ The postponed block does *not* halt the thread, but is scheduled on
221
+ the runloop as well. This means that your runloop based code will have
222
+ a chance to perform its job before the assertions in the block are
223
+ executed.
224
+
225
+ You can schedule as many blocks as you’d want and even nest them.
226
+
227
+
228
+ == bacon standalone runner
229
+
230
+ -s, --specdox do AgileDox-like output (default)
231
+ -q, --quiet do Test::Unit-like non-verbose output
232
+ -p, --tap do TAP (Test Anything Protocol) output
233
+ -k, --knock do Knock output
234
+ -o, --output FORMAT do FORMAT (SpecDox/TestUnit/Tap) output
235
+ -Q, --no-backtrace don't print backtraces
236
+ -a, --automatic gather tests from ./test/, include ./lib/
237
+ -n, --name NAME runs tests matching regexp NAME
238
+ -t, --testcase TESTCASE runs tests in TestCases matching regexp TESTCASE
239
+
240
+
241
+ == Object#should
242
+
243
+ You can use Object#should outside of contexts, where the result of
244
+ assertion will be returned as a boolean. This is nice for
245
+ demonstrations, quick checks and doctest tests.
246
+
247
+ >> require 'mac_bacon'
248
+ >> (1 + 1).should.equal 2
249
+ => true
250
+ >> (6*9).should.equal 42
251
+ => false
252
+
253
+
254
+ == Converting specs
255
+
256
+ spec-converter is a simple tool to convert test-unit or dust style
257
+ tests to test/spec specs.
258
+
259
+ It can be found at http://opensource.thinkrelevance.com/wiki/spec_converter.
260
+
261
+
262
+ == Thanks to
263
+
264
+ * Michael Fellinger, for fixing Bacon for 1.9 and various improvements.
265
+ * Gabriele Renzi, for implementing Context#should.
266
+ * James Tucker, for the autotest support.
267
+ * Yossef Mendelssohn, for nested contexts.
268
+ * everyone contributing bug fixes.
269
+
270
+
271
+ == History
272
+
273
+ * January 7, 2008: First public release 0.9.
274
+
275
+ * July 6th, 2008: Second public release 1.0.
276
+ * Add Context#should as a shortcut for Context#it('should ' + _).
277
+ * describe now supports multiple arguments for better organization.
278
+ * Empty specifications are now erroneous.
279
+ * after-blocks run in the case of exceptions too.
280
+ * Autotest support.
281
+ * Bug fixes.
282
+
283
+ * November 30th, 2008: Third public release 1.1.
284
+ * Nested before/after.
285
+ * Add -Q/--no-backtraces to not show details about failed specifications.
286
+ * Add Knock output.
287
+ * Bug fixes.
288
+
289
+ * January 10th, 2011: MacBacon fork release 1.1
290
+ * Make it work in a NSRunloop environment
291
+ * Add `wait'
292
+ * Remove extras, for now
293
+
294
+ == Contact
295
+
296
+ Please mail bugs, suggestions and patches for Bacon to
297
+ <mailto:chneukirchen@gmail.com>
298
+
299
+ Git repository (patches rebased on HEAD are most welcome):
300
+ https://github.com/chneukirchen/bacon
301
+ git://github.com/chneukirchen/bacon.git
302
+
303
+ For MacBacon contact
304
+ <mailto:eloy.de.enige@gmail.com>
305
+
306
+ And repository location:
307
+ https://github.com/alloy/MacBacon
308
+ git://github.com/alloy/MacBacon.git
309
+
310
+ == Copying
311
+
312
+ Copyright (C) 2007, 2008 Christian Neukirchen <purl.org/net/chneukirchen>
313
+
314
+ Bacon is freely distributable under the terms of an MIT-style license.
315
+ See COPYING or http://www.opensource.org/licenses/mit-license.php.
316
+
317
+
318
+ == Links
319
+
320
+ Behavior-Driven Development:: <http://behaviour-driven.org/>
321
+ RSpec:: <http://rspec.rubyforge.org/>
322
+ test/spec:: <http://test-spec.rubyforge.org/>
323
+
324
+ Christian Neukirchen:: <http://chneukirchen.org/>