bacon 1.1.0 → 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.travis.yml +12 -0
- data/COPYING +1 -1
- data/ChangeLog +147 -17
- data/RDOX +60 -56
- data/{README → README.rdoc} +10 -1
- data/Rakefile +4 -62
- data/bacon.gemspec +25 -0
- data/bin/bacon +1 -0
- data/lib/autotest/bacon.rb +2 -2
- data/lib/bacon.rb +28 -31
- data/test/spec_bacon.rb +55 -14
- data/test/spec_nontrue.rb +14 -0
- data/test/spec_should.rb +1 -1
- metadata +39 -34
data/.travis.yml
ADDED
data/COPYING
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
Copyright (c) 2007, 2008 Christian Neukirchen <purl.org/net/chneukirchen>
|
1
|
+
Copyright (c) 2007, 2008, 2012 Christian Neukirchen <purl.org/net/chneukirchen>
|
2
2
|
|
3
3
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
4
4
|
of this software and associated documentation files (the "Software"), to
|
data/ChangeLog
CHANGED
@@ -1,3 +1,131 @@
|
|
1
|
+
Fri Dec 21 11:49:56 2012 +0100 Christian Neukirchen <chneukirchen@gmail.com>
|
2
|
+
* Update README
|
3
|
+
|
4
|
+
Fri Dec 21 11:45:44 2012 +0100 Christian Neukirchen <chneukirchen@gmail.com>
|
5
|
+
* Replace ChangeLog generator
|
6
|
+
|
7
|
+
Fri Dec 21 11:45:31 2012 +0100 Christian Neukirchen <chneukirchen@gmail.com>
|
8
|
+
* Update copyright years
|
9
|
+
|
10
|
+
Fri Dec 21 11:42:19 2012 +0100 Christian Neukirchen <chneukirchen@gmail.com>
|
11
|
+
* Rename README README.rdoc
|
12
|
+
|
13
|
+
Wed Mar 21 04:27:31 2012 -0700 Christian Neukirchen <chneukirchen@gmail.com>
|
14
|
+
* Merge pull request #11 from cldwalker/fix_change_tests
|
15
|
+
|
16
|
+
Fix change tests for jruby and sometimes 1.8.7
|
17
|
+
Tue Mar 20 18:19:29 2012 -0400 Gabriel Horner <gabriel.horner@gmail.com>
|
18
|
+
* all tests green - remove allowed_failures for travis
|
19
|
+
|
20
|
+
Tue Mar 20 18:02:51 2012 -0400 Gabriel Horner <gabriel.horner@gmail.com>
|
21
|
+
* fix should.change tests failing intermittently on jruby + 1.8.7
|
22
|
+
|
23
|
+
see http://travis-ci.org/#!/cldwalker/bacon/builds/910141 tests were
|
24
|
+
running so fast that Time.now remains the same
|
25
|
+
|
26
|
+
Fri Mar 16 19:30:08 2012 +0100 Christian Neukirchen <chneukirchen@gmail.com>
|
27
|
+
* Update README
|
28
|
+
|
29
|
+
Fri Mar 16 11:42:46 2012 -0400 Gabriel Horner <gabriel.horner@gmail.com>
|
30
|
+
* Add travis to see tests pass on supported rubies
|
31
|
+
|
32
|
+
Fri Mar 16 19:14:14 2012 +0100 Christian Neukirchen <chneukirchen@gmail.com>
|
33
|
+
* Push version to 1.2
|
34
|
+
|
35
|
+
Fri Mar 16 19:11:20 2012 +0100 Christian Neukirchen <chneukirchen@gmail.com>
|
36
|
+
* Add tests for should.==
|
37
|
+
|
38
|
+
Proposed by Gabriel Horner <gabriel.horner@gmail.com>.
|
39
|
+
|
40
|
+
Fri Mar 16 19:05:34 2012 +0100 Christian Neukirchen <chneukirchen@gmail.com>
|
41
|
+
* Remove passing arguments in #satisfy, simplify argument parsing
|
42
|
+
|
43
|
+
This feature was never used and triggers a JRuby bug:
|
44
|
+
http://jira.codehaus.org/browse/JRUBY-6550
|
45
|
+
|
46
|
+
Proposed by Gabriel Horner <gabriel.horner@gmail.com>.
|
47
|
+
|
48
|
+
Fri Mar 16 19:03:58 2012 +0100 Christian Neukirchen <chneukirchen@gmail.com>
|
49
|
+
* Whitespace cleanup
|
50
|
+
|
51
|
+
Sun Feb 26 17:50:46 2012 +0100 Christian Neukirchen <chneukirchen@gmail.com>
|
52
|
+
* Add specs for change?
|
53
|
+
|
54
|
+
Sun Feb 26 17:48:57 2012 +0100 Christian Neukirchen <chneukirchen@gmail.com>
|
55
|
+
* Fix Context#change?
|
56
|
+
|
57
|
+
Wed Dec 28 12:23:29 2011 +0100 Christian Neukirchen <chneukirchen@gmail.com>
|
58
|
+
* Merge remote-tracking branch 'jeffkreeftmeijer/master'
|
59
|
+
|
60
|
+
Wed Dec 28 03:17:12 2011 -0800 Christian Neukirchen <chneukirchen@gmail.com>
|
61
|
+
* Merge pull request #6 from manveru/master
|
62
|
+
|
63
|
+
Two minor fixes
|
64
|
+
Wed Dec 28 03:54:58 2011 +0100 Michael Fellinger <m.fellinger@gmail.com>
|
65
|
+
* Avoid warning about unused variable
|
66
|
+
|
67
|
+
Wed Dec 28 03:54:19 2011 +0100 Michael Fellinger <m.fellinger@gmail.com>
|
68
|
+
* Update deprecated calls in rakefile
|
69
|
+
|
70
|
+
Sun Jan 16 14:38:05 2011 +0100 Jeff Kreeftmeijer <jeff@kreeftmeijer.nl>
|
71
|
+
* Move the Gem::Specification to bacon.gemspec
|
72
|
+
|
73
|
+
So the gem can be built and released using gem build and gem push and to
|
74
|
+
allow tools like Bundler to install Bacon from git or from the local
|
75
|
+
filesystem.
|
76
|
+
|
77
|
+
Wed Apr 14 05:40:31 2010 -0400 Gabriel Horner <gabriel.horner@gmail.com>
|
78
|
+
* Indent nested contexts for SpecDoxOutput Based on similar patch from
|
79
|
+
http://github.com/wvl/bacon/commit/af940dbeb789f5eef2d998e227e5425d
|
80
|
+
|
81
|
+
Mon Mar 29 14:06:47 2010 +0200 Christian Neukirchen <chneukirchen@gmail.com>
|
82
|
+
* Merge remote branch 'cldwalker/timer'
|
83
|
+
|
84
|
+
Sun Mar 28 23:16:49 2010 -0400 Gabriel Horner <gabriel.horner@gmail.com>
|
85
|
+
* give TestUnitOutput the same timer that Test::Unit has
|
86
|
+
|
87
|
+
Sat Mar 20 04:19:18 2010 -0400 Gabriel Horner <gabriel.horner@gmail.com>
|
88
|
+
* methods in a context should serve as behavior that is inherited by sibling
|
89
|
+
contexts
|
90
|
+
|
91
|
+
Sun Jan 17 12:17:42 2010 -0800 Eoin Hennessy <eoin@randomrules.org>
|
92
|
+
* Add support for finding specs with RSpec style naming.
|
93
|
+
|
94
|
+
Tue Sep 22 21:17:55 2009 +0200 Christian Neukirchen <chneukirchen@gmail.com>
|
95
|
+
* Add ChangeLog as gem dependency reported by lian
|
96
|
+
|
97
|
+
Mon Aug 31 23:36:56 2009 +0200 Eloy Duran <eloy.de.enige@gmail.com>
|
98
|
+
* Revert old change that was made because 1.9.0 couldn't rescue a splatted
|
99
|
+
array of Exception classes. MacRuby currently can't use when with the same
|
100
|
+
array and 1.9.2dev does.
|
101
|
+
|
102
|
+
Also some other minor changes which didn't work currently on 1.9.2dev,
|
103
|
+
but are nicer anyway imo.
|
104
|
+
|
105
|
+
Thu Jan 22 06:07:53 2009 +0000 Anna Gabutero <amdg@lavabit.com>
|
106
|
+
* Add libs to include path when invoking Test::Unit
|
107
|
+
|
108
|
+
Sun Jan 11 14:41:01 2009 +0100 Christian Neukirchen <chneukirchen@gmail.com>
|
109
|
+
* Update homepage
|
110
|
+
|
111
|
+
Sat Jan 10 14:01:30 2009 -0800 Christian Neukirchen <chneukirchen@gmail.com>
|
112
|
+
* Allow negated nontrue values outside specs
|
113
|
+
|
114
|
+
Sat Jan 10 13:44:14 2009 -0800 Ian Dees <undees@gmail.com>
|
115
|
+
* Added test for nontrue values outside specs
|
116
|
+
|
117
|
+
Sun Nov 30 11:14:31 2008 +0100 Christian Neukirchen <chneukirchen@gmail.com>
|
118
|
+
* Push VERSION to 1.1
|
119
|
+
|
120
|
+
Sun Nov 30 11:13:33 2008 +0100 Christian Neukirchen <chneukirchen@gmail.com>
|
121
|
+
* Last fixes
|
122
|
+
|
123
|
+
Sun Nov 30 11:06:09 2008 +0100 Christian Neukirchen <chneukirchen@gmail.com>
|
124
|
+
* Update README
|
125
|
+
|
126
|
+
Sun Nov 30 11:00:28 2008 +0100 Christian Neukirchen <chneukirchen@gmail.com>
|
127
|
+
* Add Knock output
|
128
|
+
|
1
129
|
Sat Oct 25 12:30:00 2008 +0200 Christian Neukirchen <chneukirchen@gmail.com>
|
2
130
|
* De-metaprogram and document nested before/after
|
3
131
|
|
@@ -15,10 +143,10 @@ Fri Oct 24 17:06:18 2008 -0500 Yossef Mendelssohn <ymendel@pobox.com>
|
|
15
143
|
|
16
144
|
Fri Oct 24 17:01:51 2008 -0500 Yossef Mendelssohn <ymendel@pobox.com>
|
17
145
|
* Letting before blocks be run from higher levels in nested context
|
18
|
-
|
19
|
-
Split up Context#initialize to let running be a separate step.
|
20
|
-
|
21
|
-
to them without resorting to instance variables.
|
146
|
+
|
147
|
+
Split up Context#initialize to let running be a separate step. Added
|
148
|
+
attr_reader for Context name and block to let the running step have
|
149
|
+
access to them without resorting to instance variables.
|
22
150
|
|
23
151
|
Sat Oct 4 13:38:23 2008 +0200 Christian Neukirchen <chneukirchen@gmail.com>
|
24
152
|
* Move to git
|
@@ -31,8 +159,9 @@ Sun Aug 17 12:48:29 2008 +0200 Christian Neukirchen <chneukirchen@gmail.com>
|
|
31
159
|
|
32
160
|
Fri Aug 1 12:01:28 2008 +0200 jftucker <jftucker@gmail.com>
|
33
161
|
* pols-for-at-exit
|
34
|
-
|
35
|
-
Added an alias for summary_on_exit to summary_at_exit to save on POLS
|
162
|
+
|
163
|
+
Added an alias for summary_on_exit to summary_at_exit to save on POLS
|
164
|
+
for some people (me!).
|
36
165
|
|
37
166
|
Sun Jul 6 18:47:42 2008 +0200 Christian Neukirchen <chneukirchen@gmail.com>
|
38
167
|
* Add bacon_rspec.rb to avoid errors when .bacon doesn't exist
|
@@ -60,19 +189,19 @@ Wed Jun 25 13:20:29 2008 +0200 jftucker <jftucker@gmail.com>
|
|
60
189
|
|
61
190
|
Wed Jun 25 00:27:08 2008 +0200 jftucker <jftucker@gmail.com>
|
62
191
|
* adding autotest support
|
63
|
-
|
64
|
-
The autotest auto discovery uses bacons test/unit output.
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
192
|
+
|
193
|
+
The autotest auto discovery uses bacons test/unit output. It does not
|
194
|
+
currently call specific examples (TODO). It currently attempts to fix
|
195
|
+
the rspec auto discovery by removing it if it finds a .bacon under test/
|
196
|
+
or spec/. In fact, these are the only conditions under which the bacon
|
197
|
+
autotest will load.
|
69
198
|
|
70
199
|
Thu Mar 13 04:00:42 2008 +0100 Michael Fellinger m.fellinger@gmail.com <chneukirchen@gmail.com>
|
71
200
|
* Show exception instead of missing error if a spec is empty because of it.
|
72
201
|
|
73
202
|
Sun Mar 2 11:52:38 2008 +0100 Christian Neukirchen <chneukirchen@gmail.com>
|
74
203
|
* Call after-blocks even if before-blocks or spec raise exceptions
|
75
|
-
|
204
|
+
|
76
205
|
Based on a patch by Keita Yamaguchi
|
77
206
|
|
78
207
|
Sun Mar 2 11:52:09 2008 +0100 Christian Neukirchen <chneukirchen@gmail.com>
|
@@ -88,11 +217,12 @@ Sun Feb 10 14:49:58 2008 +0100 Michael Fellinger <m.fellinger@gmail.com>
|
|
88
217
|
* Improve require for lib/bacon
|
89
218
|
|
90
219
|
Wed Jan 23 23:59:40 2008 +0100 rff.rff <rff.rff@gmail.com>
|
91
|
-
* allows multiple arguments to #describe to allow specialized behaviours such
|
92
|
-
|
220
|
+
* allows multiple arguments to #describe to allow specialized behaviours such
|
221
|
+
as
|
222
|
+
|
93
223
|
describe Queue,'empty'
|
94
|
-
|
95
|
-
|
224
|
+
describe Queue,'full'
|
225
|
+
|
96
226
|
Some tests for this and manveru's latest patch are included
|
97
227
|
|
98
228
|
Sat Jan 19 23:07:25 2008 +0100 Michael Fellinger <m.fellinger@gmail.com>
|
data/RDOX
CHANGED
@@ -1,69 +1,73 @@
|
|
1
|
-
|
2
|
-
- should
|
3
|
-
- should
|
4
|
-
- should
|
5
|
-
- should
|
6
|
-
- should
|
7
|
-
- should have
|
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
|
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
|
1
|
+
#should shortcut for #it('should')
|
2
|
+
- should be called
|
3
|
+
- should save some characters by typing should
|
4
|
+
- should save characters even on failure
|
5
|
+
- should work nested
|
6
|
+
- should add new specifications
|
7
|
+
- should have been called
|
25
8
|
|
26
|
-
|
27
|
-
- should
|
28
|
-
|
29
|
-
- should run from higher level
|
30
|
-
- should run at the nested level
|
31
|
-
- should run in the right order
|
9
|
+
A non-true value
|
10
|
+
- should pass negated tests inside specs
|
11
|
+
- should pass negated tests outside specs
|
32
12
|
|
33
|
-
|
34
|
-
|
35
|
-
- should
|
13
|
+
Bacon
|
14
|
+
- should have should.satisfy
|
15
|
+
- should have should.==
|
16
|
+
- should have should.equal
|
17
|
+
- should have should.raise
|
18
|
+
- should have should.change
|
19
|
+
- should have should.raise with a block
|
20
|
+
- should have a should.raise should return the exception
|
21
|
+
- should have should.be.an.instance_of
|
22
|
+
- should have should.be.nil
|
23
|
+
- should have should.include
|
24
|
+
- should have should.be.a.kind_of
|
25
|
+
- should have should.match
|
26
|
+
- should have should.not.raise
|
27
|
+
- should have should.throw
|
28
|
+
- should have should.not.satisfy
|
29
|
+
- should have should.not.equal
|
30
|
+
- should have should.not.match
|
31
|
+
- should have should.be.identical_to/same_as
|
32
|
+
- should have should.respond_to
|
33
|
+
- should have should.be.close
|
34
|
+
- should support multiple negation
|
35
|
+
- should have should.<predicate>
|
36
|
+
- should have should <operator> (>, >=, <, <=, ===)
|
37
|
+
- should allow for custom shoulds
|
38
|
+
- should have should.flunk
|
36
39
|
|
40
|
+
before/after
|
41
|
+
- should run in the right order
|
42
|
+
when nested
|
43
|
+
- should run from higher level
|
44
|
+
- should run at the nested level
|
45
|
+
- should run in the right order
|
46
|
+
- should not run from lower level
|
47
|
+
when nested at a sibling level
|
48
|
+
- should not run from sibling level
|
37
49
|
|
38
50
|
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
|
-
describe arguments
|
45
|
-
- should work with stringstring
|
51
|
+
- gets called where it is included
|
52
|
+
- raises NameError when the context is not found
|
53
|
+
- gets called where it is included
|
54
|
+
- can access data
|
46
55
|
|
56
|
+
Methods
|
57
|
+
- should be accessible in a test
|
58
|
+
when in a sibling context
|
59
|
+
- should be accessible in a test
|
47
60
|
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
- should work with modulesBacon
|
52
|
-
|
53
|
-
|
54
|
-
- should work with namespaced modulesBacon::Context
|
61
|
+
describe arguments
|
62
|
+
- should work with string string
|
55
63
|
|
64
|
+
- should work with symbols behaviour
|
56
65
|
|
57
|
-
- should work with
|
66
|
+
- should work with modules Bacon
|
58
67
|
|
68
|
+
- should work with namespaced modules Bacon::Context
|
59
69
|
|
70
|
+
- should work with multiple arguments Bacon::Context empty
|
60
71
|
|
61
|
-
#should shortcut for #it('should')
|
62
|
-
- should be called
|
63
|
-
- should save some characters by typing should
|
64
|
-
- should save characters even on failure
|
65
|
-
- should work nested
|
66
|
-
- should add new specifications
|
67
|
-
- should have been called
|
68
72
|
|
69
|
-
|
73
|
+
50 specifications (408 requirements), 0 failures, 0 errors
|
data/{README → README.rdoc}
RENAMED
@@ -262,6 +262,15 @@ It can be found at http://opensource.thinkrelevance.com/wiki/spec_converter.
|
|
262
262
|
* Add Knock output.
|
263
263
|
* Bug fixes.
|
264
264
|
|
265
|
+
* December 21th, 2012: Fourth public release 1.2.0.
|
266
|
+
* #satisfy will not pass arguments anymore to the block, use lexical scope.
|
267
|
+
* Fixed Context#change?.
|
268
|
+
* Add support for finding specs named like spec/**/*_spec.rb.
|
269
|
+
* Contexts nest properly.
|
270
|
+
* Timer in TestUnitOutput.
|
271
|
+
* Nested output for SpecDoxOutput.
|
272
|
+
* Small cleanups and more tests.
|
273
|
+
|
265
274
|
|
266
275
|
== Contact
|
267
276
|
|
@@ -275,7 +284,7 @@ git://github.com/chneukirchen/bacon.git
|
|
275
284
|
|
276
285
|
== Copying
|
277
286
|
|
278
|
-
Copyright (C) 2007, 2008 Christian Neukirchen <purl.org/net/chneukirchen>
|
287
|
+
Copyright (C) 2007, 2008, 2012 Christian Neukirchen <purl.org/net/chneukirchen>
|
279
288
|
|
280
289
|
Bacon is freely distributable under the terms of an MIT-style license.
|
281
290
|
See COPYING or http://www.opensource.org/licenses/mit-license.php.
|
data/Rakefile
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
# Rakefile for Bacon. -*-ruby-*-
|
2
|
-
require '
|
2
|
+
require 'rdoc/task'
|
3
3
|
require 'rake/testtask'
|
4
4
|
|
5
5
|
|
@@ -50,20 +50,7 @@ end
|
|
50
50
|
|
51
51
|
desc "Generate a ChangeLog"
|
52
52
|
task :changelog do
|
53
|
-
|
54
|
-
`git log -z`.split("\0").map { |chunk|
|
55
|
-
author = chunk[/Author: (.*)/, 1].strip
|
56
|
-
date = chunk[/Date: (.*)/, 1].strip
|
57
|
-
desc, detail = $'.strip.split("\n", 2)
|
58
|
-
detail ||= ""
|
59
|
-
detail = detail.gsub(/.*darcs-hash:.*/, '')
|
60
|
-
detail.rstrip!
|
61
|
-
out.puts "#{date} #{author}"
|
62
|
-
out.puts " * #{desc.strip}"
|
63
|
-
out.puts detail unless detail.empty?
|
64
|
-
out.puts
|
65
|
-
}
|
66
|
-
}
|
53
|
+
sh "git log --format='%ad %an <%ae>%n%w(79,2,4)* %s%n%n%w(76,4,4)%b' |grep -v darcs-hash: |cat -s >ChangeLog"
|
67
54
|
end
|
68
55
|
|
69
56
|
|
@@ -78,59 +65,14 @@ task :test do
|
|
78
65
|
end
|
79
66
|
|
80
67
|
|
81
|
-
begin
|
82
|
-
$" << "sources" if defined? FromSrc
|
83
|
-
require 'rubygems'
|
84
|
-
|
85
|
-
require 'rake'
|
86
|
-
require 'rake/clean'
|
87
|
-
require 'rake/packagetask'
|
88
|
-
require 'rake/gempackagetask'
|
89
|
-
require 'fileutils'
|
90
|
-
rescue LoadError
|
91
|
-
# Too bad.
|
92
|
-
else
|
93
|
-
spec = Gem::Specification.new do |s|
|
94
|
-
s.name = "bacon"
|
95
|
-
s.version = gem_version
|
96
|
-
s.platform = Gem::Platform::RUBY
|
97
|
-
s.summary = "a small RSpec clone"
|
98
|
-
|
99
|
-
s.description = <<-EOF
|
100
|
-
Bacon is a small RSpec clone weighing less than 350 LoC but
|
101
|
-
nevertheless providing all essential features.
|
102
|
-
|
103
|
-
http://github.com/chneukirchen/bacon
|
104
|
-
EOF
|
105
|
-
|
106
|
-
s.files = manifest + %w(RDOX ChangeLog)
|
107
|
-
s.bindir = 'bin'
|
108
|
-
s.executables << 'bacon'
|
109
|
-
s.require_path = 'lib'
|
110
|
-
s.has_rdoc = true
|
111
|
-
s.extra_rdoc_files = ['README', 'RDOX']
|
112
|
-
s.test_files = []
|
113
|
-
|
114
|
-
s.author = 'Christian Neukirchen'
|
115
|
-
s.email = 'chneukirchen@gmail.com'
|
116
|
-
s.homepage = 'http://chneukirchen.org/repos/bacon'
|
117
|
-
end
|
118
|
-
|
119
|
-
Rake::GemPackageTask.new(spec) do |p|
|
120
|
-
p.gem_spec = spec
|
121
|
-
p.need_tar = false
|
122
|
-
p.need_zip = false
|
123
|
-
end
|
124
|
-
end
|
125
|
-
|
126
68
|
desc "Generate RDoc documentation"
|
127
69
|
Rake::RDocTask.new(:rdoc) do |rdoc|
|
128
70
|
rdoc.options << '--line-numbers' << '--inline-source' <<
|
129
|
-
'--main' << 'README' <<
|
71
|
+
'--main' << 'README.rdoc' <<
|
130
72
|
'--title' << 'Bacon Documentation' <<
|
131
73
|
'--charset' << 'utf-8'
|
132
74
|
rdoc.rdoc_dir = "doc"
|
133
|
-
rdoc.rdoc_files.include 'README'
|
75
|
+
rdoc.rdoc_files.include 'README.rdoc'
|
134
76
|
rdoc.rdoc_files.include 'COPYING'
|
135
77
|
rdoc.rdoc_files.include 'RDOX'
|
136
78
|
rdoc.rdoc_files.include('lib/bacon.rb')
|
data/bacon.gemspec
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
Gem::Specification.new do |s|
|
2
|
+
s.name = "bacon"
|
3
|
+
s.version = '1.2.0'
|
4
|
+
s.platform = Gem::Platform::RUBY
|
5
|
+
s.summary = "a small RSpec clone"
|
6
|
+
|
7
|
+
s.description = <<-EOF
|
8
|
+
Bacon is a small RSpec clone weighing less than 350 LoC but
|
9
|
+
nevertheless providing all essential features.
|
10
|
+
|
11
|
+
http://github.com/chneukirchen/bacon
|
12
|
+
EOF
|
13
|
+
|
14
|
+
s.files = `git ls-files`.split("\n") - [".gitignore"] + %w(RDOX ChangeLog)
|
15
|
+
s.bindir = 'bin'
|
16
|
+
s.executables << 'bacon'
|
17
|
+
s.require_path = 'lib'
|
18
|
+
s.has_rdoc = true
|
19
|
+
s.extra_rdoc_files = ['README.rdoc', 'RDOX']
|
20
|
+
s.test_files = []
|
21
|
+
|
22
|
+
s.author = 'Christian Neukirchen'
|
23
|
+
s.email = 'chneukirchen@gmail.com'
|
24
|
+
s.homepage = 'http://github.com/chneukirchen/bacon'
|
25
|
+
end
|
data/bin/bacon
CHANGED
data/lib/autotest/bacon.rb
CHANGED
@@ -31,6 +31,6 @@ class Autotest::Bacon < Autotest
|
|
31
31
|
args = files_to_test.keys.flatten.join(' ')
|
32
32
|
args = '-a' if args.empty?
|
33
33
|
# TODO : make regex to pass to -n using values
|
34
|
-
"#{ruby} -S bacon -o TestUnit #{args}"
|
34
|
+
"#{ruby} -S bacon -I#{libs} -o TestUnit #{args}"
|
35
35
|
end
|
36
|
-
end
|
36
|
+
end
|
data/lib/bacon.rb
CHANGED
@@ -2,13 +2,13 @@
|
|
2
2
|
#
|
3
3
|
# "Truth will sooner come out from error than from confusion." ---Francis Bacon
|
4
4
|
|
5
|
-
# Copyright (C) 2007, 2008 Christian Neukirchen <purl.org/net/chneukirchen>
|
5
|
+
# Copyright (C) 2007, 2008, 2012 Christian Neukirchen <purl.org/net/chneukirchen>
|
6
6
|
#
|
7
7
|
# Bacon is freely distributable under the terms of an MIT-style license.
|
8
8
|
# See COPYING or http://www.opensource.org/licenses/mit-license.php.
|
9
9
|
|
10
10
|
module Bacon
|
11
|
-
VERSION = "1.
|
11
|
+
VERSION = "1.2"
|
12
12
|
|
13
13
|
Counter = Hash.new(0)
|
14
14
|
ErrorLog = ""
|
@@ -23,6 +23,7 @@ module Bacon
|
|
23
23
|
|
24
24
|
def self.summary_on_exit
|
25
25
|
return if Counter[:installed_summary] > 0
|
26
|
+
@timer = Time.now
|
26
27
|
at_exit {
|
27
28
|
handle_summary
|
28
29
|
if $!
|
@@ -37,13 +38,13 @@ module Bacon
|
|
37
38
|
|
38
39
|
module SpecDoxOutput
|
39
40
|
def handle_specification(name)
|
40
|
-
puts name
|
41
|
+
puts spaces + name
|
41
42
|
yield
|
42
|
-
puts
|
43
|
+
puts if Counter[:context_depth] == 1
|
43
44
|
end
|
44
45
|
|
45
46
|
def handle_requirement(description)
|
46
|
-
print "- #{description}"
|
47
|
+
print "#{spaces} - #{description}"
|
47
48
|
error = yield
|
48
49
|
puts error.empty? ? "" : " [#{error}]"
|
49
50
|
end
|
@@ -53,6 +54,10 @@ module Bacon
|
|
53
54
|
puts "%d specifications (%d requirements), %d failures, %d errors" %
|
54
55
|
Counter.values_at(:specifications, :requirements, :failed, :errors)
|
55
56
|
end
|
57
|
+
|
58
|
+
def spaces
|
59
|
+
" " * (Counter[:context_depth] - 1)
|
60
|
+
end
|
56
61
|
end
|
57
62
|
|
58
63
|
module TestUnitOutput
|
@@ -68,7 +73,7 @@ module Bacon
|
|
68
73
|
end
|
69
74
|
|
70
75
|
def handle_summary
|
71
|
-
puts
|
76
|
+
puts "", "Finished in #{Time.now - @timer} seconds."
|
72
77
|
puts ErrorLog if Backtraces
|
73
78
|
puts "%d tests, %d assertions, %d failures, %d errors" %
|
74
79
|
Counter.values_at(:specifications, :requirements, :failed, :errors)
|
@@ -127,16 +132,18 @@ module Bacon
|
|
127
132
|
|
128
133
|
class Context
|
129
134
|
attr_reader :name, :block
|
130
|
-
|
135
|
+
|
131
136
|
def initialize(name, &block)
|
132
137
|
@name = name
|
133
138
|
@before, @after = [], []
|
134
139
|
@block = block
|
135
140
|
end
|
136
|
-
|
141
|
+
|
137
142
|
def run
|
138
143
|
return unless name =~ RestrictContext
|
144
|
+
Counter[:context_depth] += 1
|
139
145
|
Bacon.handle_specification(name) { instance_eval(&block) }
|
146
|
+
Counter[:context_depth] -= 1
|
140
147
|
self
|
141
148
|
end
|
142
149
|
|
@@ -153,7 +160,7 @@ module Bacon
|
|
153
160
|
Counter[:specifications] += 1
|
154
161
|
run_requirement description, block
|
155
162
|
end
|
156
|
-
|
163
|
+
|
157
164
|
def should(*args, &block)
|
158
165
|
if Counter[:depth]==0
|
159
166
|
it('should '+args.first,&block)
|
@@ -210,6 +217,9 @@ module Bacon
|
|
210
217
|
|
211
218
|
def describe(*args, &block)
|
212
219
|
context = Bacon::Context.new(args.join(' '), &block)
|
220
|
+
(parent_context = self).methods(false).each {|e|
|
221
|
+
class<<context; self end.send(:define_method, e) {|*args| parent_context.send(e, *args)}
|
222
|
+
}
|
213
223
|
@before.each { |b| context.before(&b) }
|
214
224
|
@after.each { |b| context.after(&b) }
|
215
225
|
context.run
|
@@ -217,7 +227,7 @@ module Bacon
|
|
217
227
|
|
218
228
|
def raise?(*args, &block); block.raise?(*args); end
|
219
229
|
def throw?(*args, &block); block.throw?(*args); end
|
220
|
-
def change?(
|
230
|
+
def change?(&block); lambda{}.change?(&block); end
|
221
231
|
end
|
222
232
|
end
|
223
233
|
|
@@ -237,17 +247,9 @@ end
|
|
237
247
|
|
238
248
|
class Proc
|
239
249
|
def raise?(*exceptions)
|
240
|
-
exceptions = [RuntimeError] if exceptions.empty?
|
241
250
|
call
|
242
|
-
|
243
|
-
|
244
|
-
rescue Object => e
|
245
|
-
case e
|
246
|
-
when *exceptions
|
247
|
-
e
|
248
|
-
else
|
249
|
-
raise e
|
250
|
-
end
|
251
|
+
rescue *(exceptions.empty? ? RuntimeError : exceptions) => e
|
252
|
+
e
|
251
253
|
else
|
252
254
|
false
|
253
255
|
end
|
@@ -262,7 +264,7 @@ class Proc
|
|
262
264
|
|
263
265
|
def change?
|
264
266
|
pre_result = yield
|
265
|
-
|
267
|
+
call
|
266
268
|
post_result = yield
|
267
269
|
pre_result != post_result
|
268
270
|
end
|
@@ -285,7 +287,6 @@ module Kernel
|
|
285
287
|
def shared(name, &block) Bacon::Shared[name] = block end
|
286
288
|
end
|
287
289
|
|
288
|
-
|
289
290
|
class Should
|
290
291
|
# Kills ==, ===, =~, eql?, equal?, frozen?, instance_of?, is_a?,
|
291
292
|
# kind_of?, nil?, respond_to?, tainted?
|
@@ -318,19 +319,15 @@ class Should
|
|
318
319
|
alias a be
|
319
320
|
alias an be
|
320
321
|
|
321
|
-
def satisfy(
|
322
|
-
|
323
|
-
description = args.shift
|
324
|
-
else
|
325
|
-
description = ""
|
326
|
-
end
|
327
|
-
|
328
|
-
r = yield(@object, *args)
|
322
|
+
def satisfy(description="", &block)
|
323
|
+
r = yield(@object)
|
329
324
|
if Bacon::Counter[:depth] > 0
|
330
325
|
Bacon::Counter[:requirements] += 1
|
331
326
|
raise Bacon::Error.new(:failed, description) unless @negated ^ r
|
327
|
+
r
|
328
|
+
else
|
329
|
+
@negated ? !r : !!r
|
332
330
|
end
|
333
|
-
@negated ^ r ? r : false
|
334
331
|
end
|
335
332
|
|
336
333
|
def method_missing(name, *args, &block)
|
data/test/spec_bacon.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
$-w,w = nil, $-w
|
2
|
-
require File.
|
2
|
+
require File.expand_path('../../lib/bacon', __FILE__)
|
3
3
|
$-w = w
|
4
4
|
|
5
5
|
# Hooray for meta-testing.
|
@@ -27,7 +27,7 @@ end
|
|
27
27
|
|
28
28
|
describe "Bacon" do
|
29
29
|
extend MetaTests
|
30
|
-
|
30
|
+
|
31
31
|
it "should have should.satisfy" do
|
32
32
|
lambda { should.satisfy { 1 == 1 } }.should succeed
|
33
33
|
lambda { should.satisfy { 1 } }.should succeed
|
@@ -40,6 +40,14 @@ describe "Bacon" do
|
|
40
40
|
lambda { 2.should.satisfy { |n| n % 2 == 0 } }.should succeed
|
41
41
|
end
|
42
42
|
|
43
|
+
it "should have should.==" do
|
44
|
+
lambda { "string1".should == "string1" }.should succeed
|
45
|
+
lambda { "string1".should == "string2" }.should fail
|
46
|
+
|
47
|
+
lambda { [1,2,3].should == [1,2,3] }.should succeed
|
48
|
+
lambda { [1,2,3].should == [1,2,4] }.should fail
|
49
|
+
end
|
50
|
+
|
43
51
|
it "should have should.equal" do
|
44
52
|
lambda { "string1".should == "string1" }.should succeed
|
45
53
|
lambda { "string1".should == "string2" }.should fail
|
@@ -62,6 +70,23 @@ describe "Bacon" do
|
|
62
70
|
}.should.raise
|
63
71
|
end
|
64
72
|
|
73
|
+
it "should have should.change" do
|
74
|
+
lambda { lambda {}.should.change { sleep 0.001; Time.now } }.should succeed
|
75
|
+
|
76
|
+
lambda {
|
77
|
+
i = 1
|
78
|
+
lambda { i *= 2 }.should.change { i }
|
79
|
+
}.should succeed
|
80
|
+
|
81
|
+
lambda {
|
82
|
+
i = 0
|
83
|
+
lambda { i *= 2 }.should.change { i }
|
84
|
+
}.should fail
|
85
|
+
|
86
|
+
lambda { should.change { sleep 0.001; Time.now } }.should succeed
|
87
|
+
lambda { should.change { 42 } }.should fail
|
88
|
+
end
|
89
|
+
|
65
90
|
it "should have should.raise with a block" do
|
66
91
|
lambda { should.raise { raise "Error" } }.should succeed
|
67
92
|
lambda { should.raise(RuntimeError) { raise "Error" } }.should succeed
|
@@ -79,7 +104,7 @@ describe "Bacon" do
|
|
79
104
|
ex.should.be.kind_of RuntimeError
|
80
105
|
ex.message.should =~ /foo/
|
81
106
|
end
|
82
|
-
|
107
|
+
|
83
108
|
it "should have should.be.an.instance_of" do
|
84
109
|
lambda { "string".should.be.instance_of String }.should succeed
|
85
110
|
lambda { "string".should.be.instance_of Hash }.should fail
|
@@ -132,7 +157,7 @@ describe "Bacon" do
|
|
132
157
|
}.should.not.raise(RuntimeError, Comparable)
|
133
158
|
}.should.raise ZeroDivisionError
|
134
159
|
}.should succeed
|
135
|
-
|
160
|
+
|
136
161
|
lambda { lambda { raise "Error" }.should.not.raise }.should fail
|
137
162
|
end
|
138
163
|
|
@@ -176,7 +201,7 @@ describe "Bacon" do
|
|
176
201
|
lambda { 5.should.respond_to :to_str }.should fail
|
177
202
|
lambda { :foo.should.respond_to :nx }.should fail
|
178
203
|
end
|
179
|
-
|
204
|
+
|
180
205
|
it "should have should.be.close" do
|
181
206
|
lambda { 1.4.should.be.close 1.4, 0 }.should succeed
|
182
207
|
lambda { 0.4.should.be.close 0.5, 0.1 }.should succeed
|
@@ -273,40 +298,40 @@ describe "before/after" do
|
|
273
298
|
after do
|
274
299
|
@a.should.equal 3
|
275
300
|
end
|
276
|
-
|
301
|
+
|
277
302
|
it "should run in the right order" do
|
278
303
|
@a.should.equal 2
|
279
304
|
@b.should.equal 2
|
280
305
|
end
|
281
|
-
|
306
|
+
|
282
307
|
describe "when nested" do
|
283
308
|
before do
|
284
309
|
@c = 5
|
285
310
|
end
|
286
|
-
|
311
|
+
|
287
312
|
it "should run from higher level" do
|
288
313
|
@a.should.equal 2
|
289
314
|
@b.should.equal 2
|
290
315
|
end
|
291
|
-
|
316
|
+
|
292
317
|
it "should run at the nested level" do
|
293
318
|
@c.should.equal 5
|
294
319
|
end
|
295
|
-
|
320
|
+
|
296
321
|
before do
|
297
322
|
@a = 5
|
298
323
|
end
|
299
|
-
|
324
|
+
|
300
325
|
it "should run in the right order" do
|
301
326
|
@a.should.equal 5
|
302
327
|
@a = 2
|
303
328
|
end
|
304
329
|
end
|
305
|
-
|
330
|
+
|
306
331
|
it "should not run from lower level" do
|
307
332
|
@c.should.be.nil
|
308
333
|
end
|
309
|
-
|
334
|
+
|
310
335
|
describe "when nested at a sibling level" do
|
311
336
|
it "should not run from sibling level" do
|
312
337
|
@c.should.be.nil
|
@@ -344,6 +369,22 @@ describe "shared/behaves_like" do
|
|
344
369
|
behaves_like "another shared context"
|
345
370
|
end
|
346
371
|
|
372
|
+
describe "Methods" do
|
373
|
+
def the_meaning_of_life
|
374
|
+
42
|
375
|
+
end
|
376
|
+
|
377
|
+
it "should be accessible in a test" do
|
378
|
+
the_meaning_of_life.should == 42
|
379
|
+
end
|
380
|
+
|
381
|
+
describe "when in a sibling context" do
|
382
|
+
it "should be accessible in a test" do
|
383
|
+
the_meaning_of_life.should == 42
|
384
|
+
end
|
385
|
+
end
|
386
|
+
end
|
387
|
+
|
347
388
|
describe 'describe arguments' do
|
348
389
|
|
349
390
|
def check(ctx,name)
|
@@ -358,7 +399,7 @@ describe 'describe arguments' do
|
|
358
399
|
it 'should work with symbols' do
|
359
400
|
check(describe(:behaviour) {},'behaviour')
|
360
401
|
end
|
361
|
-
|
402
|
+
|
362
403
|
it 'should work with modules' do
|
363
404
|
check(describe(Bacon) {},'Bacon')
|
364
405
|
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
$false_is_not_true = false.should.not.be.true
|
2
|
+
$nil_is_not_true = nil.should.not.be.true
|
3
|
+
|
4
|
+
describe 'A non-true value' do
|
5
|
+
it 'should pass negated tests inside specs' do
|
6
|
+
false.should.not.be.true
|
7
|
+
nil.should.not.be.true
|
8
|
+
end
|
9
|
+
|
10
|
+
it 'should pass negated tests outside specs' do
|
11
|
+
$false_is_not_true.should.be.true
|
12
|
+
$nil_is_not_true.should.be.true
|
13
|
+
end
|
14
|
+
end
|
data/test/spec_should.rb
CHANGED
metadata
CHANGED
@@ -1,65 +1,70 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: bacon
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.2.0
|
5
|
+
prerelease:
|
5
6
|
platform: ruby
|
6
|
-
authors:
|
7
|
+
authors:
|
7
8
|
- Christian Neukirchen
|
8
9
|
autorequire:
|
9
10
|
bindir: bin
|
10
11
|
cert_chain: []
|
11
|
-
|
12
|
-
date: 2008-11-30 00:00:00 +01:00
|
13
|
-
default_executable:
|
12
|
+
date: 2012-12-21 00:00:00.000000000 Z
|
14
13
|
dependencies: []
|
14
|
+
description: ! 'Bacon is a small RSpec clone weighing less than 350 LoC but
|
15
|
+
|
16
|
+
nevertheless providing all essential features.
|
17
|
+
|
15
18
|
|
16
|
-
|
19
|
+
http://github.com/chneukirchen/bacon
|
20
|
+
|
21
|
+
'
|
17
22
|
email: chneukirchen@gmail.com
|
18
|
-
executables:
|
23
|
+
executables:
|
19
24
|
- bacon
|
20
25
|
extensions: []
|
21
|
-
|
22
|
-
|
23
|
-
- README
|
26
|
+
extra_rdoc_files:
|
27
|
+
- README.rdoc
|
24
28
|
- RDOX
|
25
|
-
files:
|
29
|
+
files:
|
30
|
+
- .travis.yml
|
26
31
|
- COPYING
|
27
|
-
- README
|
32
|
+
- README.rdoc
|
28
33
|
- Rakefile
|
34
|
+
- bacon.gemspec
|
29
35
|
- bin/bacon
|
30
36
|
- lib/autotest/bacon.rb
|
31
37
|
- lib/autotest/bacon_rspec.rb
|
32
38
|
- lib/autotest/discover.rb
|
33
39
|
- lib/bacon.rb
|
34
40
|
- test/spec_bacon.rb
|
41
|
+
- test/spec_nontrue.rb
|
35
42
|
- test/spec_should.rb
|
36
43
|
- RDOX
|
37
44
|
- ChangeLog
|
38
|
-
|
39
|
-
|
45
|
+
homepage: http://github.com/chneukirchen/bacon
|
46
|
+
licenses: []
|
40
47
|
post_install_message:
|
41
48
|
rdoc_options: []
|
42
|
-
|
43
|
-
require_paths:
|
49
|
+
require_paths:
|
44
50
|
- lib
|
45
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
51
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
52
|
+
none: false
|
53
|
+
requirements:
|
54
|
+
- - ! '>='
|
55
|
+
- !ruby/object:Gem::Version
|
56
|
+
version: '0'
|
57
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
58
|
+
none: false
|
59
|
+
requirements:
|
60
|
+
- - ! '>='
|
61
|
+
- !ruby/object:Gem::Version
|
62
|
+
version: '0'
|
57
63
|
requirements: []
|
58
|
-
|
59
64
|
rubyforge_project:
|
60
|
-
rubygems_version: 1.
|
65
|
+
rubygems_version: 1.8.23
|
61
66
|
signing_key:
|
62
|
-
specification_version:
|
67
|
+
specification_version: 3
|
63
68
|
summary: a small RSpec clone
|
64
69
|
test_files: []
|
65
|
-
|
70
|
+
has_rdoc: true
|