schmurfy-bacon 1.2

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/.gitignore ADDED
@@ -0,0 +1,8 @@
1
+ *~
2
+ ChangeLog
3
+ TODO
4
+ RDOX
5
+ ann-*
6
+ *.tar.gz
7
+ doc
8
+ pkg
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/README ADDED
@@ -0,0 +1,290 @@
1
+ = Bacon -- 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
+
10
+ == Whirl-wind tour
11
+
12
+ require 'bacon'
13
+
14
+ describe 'A new array' do
15
+ before do
16
+ @ary = Array.new
17
+ end
18
+
19
+ it 'should be empty' do
20
+ @ary.should.be.empty
21
+ @ary.should.not.include 1
22
+ end
23
+
24
+ it 'should have zero size' do
25
+ @ary.size.should.equal 0
26
+ @ary.size.should.be.close 0.1, 0.5
27
+ end
28
+
29
+ it 'should raise on trying fetch any index' do
30
+ lambda { @ary.fetch 0 }.
31
+ should.raise(IndexError).
32
+ message.should.match(/out of array/)
33
+
34
+ # Alternatively:
35
+ should.raise(IndexError) { @ary.fetch 0 }
36
+ end
37
+
38
+ it 'should have an object identity' do
39
+ @ary.should.not.be.same_as Array.new
40
+ end
41
+
42
+ # Custom assertions are trivial to do, they are lambdas returning a
43
+ # boolean vale:
44
+ palindrome = lambda { |obj| obj == obj.reverse }
45
+ it 'should be a palindrome' do
46
+ @ary.should.be.a palindrome
47
+ end
48
+
49
+ it 'should have super powers' do
50
+ should.flunk "no super powers found"
51
+ end
52
+ end
53
+
54
+ Now run it:
55
+
56
+ $ bacon whirlwind.rb
57
+ A new array
58
+ - should be empty
59
+ - should have zero size
60
+ - should raise on trying fetch any index
61
+ - should have an object identity
62
+ - should be a palindrome
63
+ - should have super powers [FAILED]
64
+
65
+ Bacon::Error: no super powers found
66
+ ./whirlwind.rb:39: A new array - should have super powers
67
+ ./whirlwind.rb:38
68
+ ./whirlwind.rb:3
69
+
70
+ 6 specifications (9 requirements), 1 failures, 0 errors
71
+
72
+ If you want shorter output, use the Test::Unit format:
73
+
74
+ $ bacon -q whirlwind.rb
75
+ .....F
76
+ Bacon::Error: no super powers found
77
+ ./whirlwind.rb:39: A new array - should have super powers
78
+ ./whirlwind.rb:38
79
+ ./whirlwind.rb:3
80
+
81
+ 6 tests, 9 assertions, 1 failures, 0 errors
82
+
83
+ It also supports TAP:
84
+
85
+ $ bacon -p whirlwind.rb
86
+ ok 1 - should be empty
87
+ ok 2 - should have zero size
88
+ ok 3 - should raise on trying fetch any index
89
+ ok 4 - should have an object identity
90
+ ok 5 - should be a palindrome
91
+ not ok 6 - should have super powers: FAILED
92
+ # Bacon::Error: no super powers found
93
+ # ./whirlwind.rb:39: A new array - should have super powers
94
+ # ./whirlwind.rb:38
95
+ # ./whirlwind.rb:3
96
+ 1..6
97
+ # 6 tests, 9 assertions, 1 failures, 0 errors
98
+
99
+ $ bacon -p whirlwind.rb | taptap -q
100
+ Tests took 0.00 seconds.
101
+ FAILED tests 6
102
+ 6) should have super powers: FAILED
103
+
104
+ Failed 1/6 tests, 83.33% okay.
105
+
106
+ (taptap is available from http://chneukirchen.org/repos/taptap/)
107
+
108
+ As of Bacon 1.1, it also supports Knock:
109
+
110
+ $ bacon -k whirlwind.rb
111
+ ok - should be empty
112
+ ok - should have zero size
113
+ ok - should raise on trying fetch any index
114
+ ok - should have an object identity
115
+ ok - should be a palindrome
116
+ not ok - should have super powers: FAILED
117
+ # Bacon::Error: no super powers found
118
+ # ./whirlwind.rb:39: A new array - should have super powers
119
+ # ./whirlwind.rb:38
120
+ # ./whirlwind.rb:3
121
+
122
+ $ bacon -k whirlwind.rb | kn-sum
123
+ 6 tests, 1 failed (83.3333% succeeded)
124
+
125
+ (knock is available from http://github.com/chneukirchen/knock/)
126
+
127
+
128
+ == Implemented assertions
129
+
130
+ * should.<predicate> and should.be.<predicate>
131
+ * should.equal
132
+ * should.match
133
+ * should.be.identical_to / should.be.same_as
134
+ * should.raise(*exceptions) { }
135
+ * should.change { }
136
+ * should.throw(symbol) { }
137
+ * should.satisfy { |object| }
138
+
139
+
140
+ == Added core predicates
141
+
142
+ * Object#true?
143
+ * Object#false?
144
+ * Proc#change?
145
+ * Proc#raise?
146
+ * Proc#throw?
147
+ * Numeric#close?
148
+
149
+
150
+ == before/after
151
+
152
+ before and after need to be defined before the first specification in
153
+ a context and are run before and after each specification.
154
+
155
+ As of Bacon 1.1, before and after do nest in nested contexts.
156
+
157
+
158
+ == Shared contexts
159
+
160
+ You can define shared contexts in Bacon like this:
161
+
162
+ shared "an empty container" do
163
+ it "should have size zero" do
164
+ end
165
+
166
+ it "should be empty" do
167
+ end
168
+ end
169
+
170
+ context "A new array" do
171
+ behaves_like "an empty container"
172
+ end
173
+
174
+ These contexts are not executed on their own, but can be included with
175
+ behaves_like in other contexts. You can use shared contexts to
176
+ structure suites with many recurring specifications.
177
+
178
+
179
+ == Matchers
180
+
181
+ Custom matchers are simply lambdas returning a boolean value, for
182
+ example:
183
+
184
+ def shorter_than(max_size)
185
+ lambda { |obj| obj.size < max_size }
186
+ end
187
+
188
+ [1,2,3].should.be shorter_than(5)
189
+
190
+ You can use modules and extend to group matchers for use in multiple
191
+ contexts.
192
+
193
+
194
+ == bacon standalone runner
195
+
196
+ -s, --specdox do AgileDox-like output (default)
197
+ -q, --quiet do Test::Unit-like non-verbose output
198
+ -p, --tap do TAP (Test Anything Protocol) output
199
+ -k, --knock do Knock output
200
+ -o, --output FORMAT do FORMAT (SpecDox/TestUnit/Tap) output
201
+ -Q, --no-backtrace don't print backtraces
202
+ -a, --automatic gather tests from ./test/, include ./lib/
203
+ -n, --name NAME runs tests matching regexp NAME
204
+ -t, --testcase TESTCASE runs tests in TestCases matching regexp TESTCASE
205
+
206
+ If you don't want to use the standalone runner, run
207
+ Bacon.summary_on_exit to install an exit handler showing the summary.
208
+
209
+
210
+ == Object#should
211
+
212
+ You can use Object#should outside of contexts, where the result of
213
+ assertion will be returned as a boolean. This is nice for
214
+ demonstrations, quick checks and doctest tests.
215
+
216
+ >> require 'bacon'
217
+ >> (1 + 1).should.equal 2
218
+ => true
219
+ >> (6*9).should.equal 42
220
+ => false
221
+
222
+
223
+ == Bacon with autotest
224
+
225
+ Since version 1.0, there is autotest support. You need to tag your
226
+ test directories (test/ or spec/) by creating an .bacon file there.
227
+ Autotest then will find it. bin/bacon needs to be in PATH or RUBYPATH.
228
+
229
+
230
+ == Converting specs
231
+
232
+ spec-converter is a simple tool to convert test-unit or dust style
233
+ tests to test/spec specs.
234
+
235
+ It can be found at http://opensource.thinkrelevance.com/wiki/spec_converter.
236
+
237
+
238
+ == Thanks to
239
+
240
+ * Michael Fellinger, for fixing Bacon for 1.9 and various improvements.
241
+ * Gabriele Renzi, for implementing Context#should.
242
+ * James Tucker, for the autotest support.
243
+ * Yossef Mendelssohn, for nested contexts.
244
+ * everyone contributing bug fixes.
245
+
246
+
247
+ == History
248
+
249
+ * January 7, 2008: First public release 0.9.
250
+
251
+ * July 6th, 2008: Second public release 1.0.
252
+ * Add Context#should as a shortcut for Context#it('should ' + _).
253
+ * describe now supports multiple arguments for better organization.
254
+ * Empty specifications are now erroneous.
255
+ * after-blocks run in the case of exceptions too.
256
+ * Autotest support.
257
+ * Bug fixes.
258
+
259
+ * November 30th, 2008: Third public release 1.1.
260
+ * Nested before/after.
261
+ * Add -Q/--no-backtraces to not show details about failed specifications.
262
+ * Add Knock output.
263
+ * Bug fixes.
264
+
265
+
266
+ == Contact
267
+
268
+ Please mail bugs, suggestions and patches to
269
+ <mailto:chneukirchen@gmail.com>.
270
+
271
+ Git repository (patches rebased on HEAD are most welcome):
272
+ http://github.com/chneukirchen/bacon
273
+ git://github.com/chneukirchen/bacon.git
274
+
275
+
276
+ == Copying
277
+
278
+ Copyright (C) 2007, 2008 Christian Neukirchen <purl.org/net/chneukirchen>
279
+
280
+ Bacon is freely distributable under the terms of an MIT-style license.
281
+ See COPYING or http://www.opensource.org/licenses/mit-license.php.
282
+
283
+
284
+ == Links
285
+
286
+ Behavior-Driven Development:: <http://behaviour-driven.org/>
287
+ RSpec:: <http://rspec.rubyforge.org/>
288
+ test/spec:: <http://test-spec.rubyforge.org/>
289
+
290
+ Christian Neukirchen:: <http://chneukirchen.org/>
data/Rakefile ADDED
@@ -0,0 +1,119 @@
1
+ # Rakefile for Bacon. -*-ruby-*-
2
+ require 'rake/testtask'
3
+
4
+
5
+ desc "Run all the tests"
6
+ task :default => [:test]
7
+
8
+ desc "Do predistribution stuff"
9
+ task :predist => [:chmod, :changelog, :rdoc]
10
+
11
+
12
+ desc "Make an archive as .tar.gz"
13
+ task :dist => [:test, :predist] do
14
+ sh "git archive --format=tar --prefix=#{release}/ HEAD^{tree} >#{release}.tar"
15
+ sh "pax -waf #{release}.tar -s ':^:#{release}/:' RDOX ChangeLog doc"
16
+ sh "gzip -f -9 #{release}.tar"
17
+ end
18
+
19
+ # Helper to retrieve the "revision number" of the git tree.
20
+ def git_tree_version
21
+ if File.directory?(".git")
22
+ @tree_version ||= `git describe`.strip.sub('-', '.')
23
+ @tree_version << ".0" unless @tree_version.count('.') == 2
24
+ else
25
+ $: << "lib"
26
+ require 'bacon'
27
+ @tree_version = Bacon::VERSION
28
+ end
29
+ @tree_version
30
+ end
31
+
32
+ def gem_version
33
+ git_tree_version.gsub(/-.*/, '')
34
+ end
35
+
36
+ def release
37
+ "bacon-#{git_tree_version}"
38
+ end
39
+
40
+ def manifest
41
+ `git ls-files`.split("\n") - [".gitignore"]
42
+ end
43
+
44
+
45
+ desc "Make binaries executable"
46
+ task :chmod do
47
+ Dir["bin/*"].each { |binary| File.chmod(0775, binary) }
48
+ end
49
+
50
+ desc "Generate a ChangeLog"
51
+ task :changelog do
52
+ File.open("ChangeLog", "w") { |out|
53
+ `git log -z`.split("\0").map { |chunk|
54
+ author = chunk[/Author: (.*)/, 1].strip
55
+ date = chunk[/Date: (.*)/, 1].strip
56
+ desc, detail = $'.strip.split("\n", 2)
57
+ detail ||= ""
58
+ detail = detail.gsub(/.*darcs-hash:.*/, '')
59
+ detail.rstrip!
60
+ out.puts "#{date} #{author}"
61
+ out.puts " * #{desc.strip}"
62
+ out.puts detail unless detail.empty?
63
+ out.puts
64
+ }
65
+ }
66
+ end
67
+
68
+
69
+ desc "Generate RDox"
70
+ task "RDOX" do
71
+ sh "bin/bacon -Ilib --automatic --specdox >RDOX"
72
+ end
73
+
74
+ desc "Run all the tests"
75
+ task :test do
76
+ ruby "bin/bacon -Ilib --automatic --quiet"
77
+ end
78
+
79
+
80
+ begin
81
+ $" << "sources" if defined? FromSrc
82
+ require 'rubygems'
83
+
84
+ require 'rake'
85
+ require 'rake/clean'
86
+ require 'rake/packagetask'
87
+ require 'fileutils'
88
+ rescue LoadError
89
+ # Too bad.
90
+ else
91
+ spec = Gem::Specification.new do |s|
92
+ s.name = "bacon"
93
+ s.version = gem_version
94
+ s.platform = Gem::Platform::RUBY
95
+ s.summary = "a small RSpec clone"
96
+
97
+ s.description = <<-EOF
98
+ Bacon is a small RSpec clone weighing less than 350 LoC but
99
+ nevertheless providing all essential features.
100
+
101
+ http://github.com/chneukirchen/bacon
102
+ EOF
103
+
104
+ s.files = manifest + %w(RDOX ChangeLog)
105
+ s.bindir = 'bin'
106
+ s.executables << 'bacon'
107
+ s.require_path = 'lib'
108
+ s.extra_rdoc_files = ['README', 'RDOX']
109
+ s.test_files = []
110
+
111
+ s.author = 'Christian Neukirchen'
112
+ s.email = 'chneukirchen@gmail.com'
113
+ s.homepage = 'http://github.com/chneukirchen/bacon'
114
+ end
115
+
116
+ task :gem => [:chmod, :changelog]
117
+ end
118
+
119
+
data/bacon.gemspec ADDED
@@ -0,0 +1,30 @@
1
+
2
+ require File.expand_path('../lib/bacon/version', __FILE__)
3
+
4
+ Gem::Specification.new do |s|
5
+ s.name = "schmurfy-bacon"
6
+ s.version = Bacon::VERSION
7
+ s.platform = Gem::Platform::RUBY
8
+ s.summary = "a small RSpec clone"
9
+
10
+ s.description = <<-EOF
11
+ Bacon is a small RSpec clone weighing less than 350 LoC but
12
+ nevertheless providing all essential features.
13
+
14
+ http://github.com/chneukirchen/bacon
15
+ EOF
16
+
17
+ s.files = `git ls-files`.split("\n")
18
+ s.bindir = 'bin'
19
+ s.executables << 'bacon'
20
+ s.require_path = 'lib'
21
+ s.extra_rdoc_files = ['README']
22
+ s.test_files = []
23
+
24
+ s.add_dependency 'term-ansicolor'
25
+
26
+
27
+ s.author = 'Christian Neukirchen'
28
+ s.email = 'chneukirchen@gmail.com'
29
+ s.homepage = 'http://github.com/chneukirchen/bacon'
30
+ end