baretest 0.2.3 → 0.2.4
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/LICENSE.txt +4 -4
- data/MANIFEST.txt +4 -2
- data/README.rdoc +3 -2
- data/bin/baretest +7 -17
- data/doc/quickref.rdoc +1 -1
- data/doc/whats_going_on.rdoc +35 -0
- data/examples/test.rake +4 -4
- data/examples/tests/irb_mode/failures.rb +1 -1
- data/lib/baretest/assertion/context.rb +1 -1
- data/lib/baretest/assertion/failure.rb +1 -1
- data/lib/baretest/assertion/skip.rb +1 -1
- data/lib/baretest/assertion/support.rb +10 -10
- data/lib/baretest/assertion.rb +1 -1
- data/lib/baretest/irb_mode.rb +7 -7
- data/lib/baretest/layout.rb +1 -1
- data/lib/baretest/rr.rb +16 -0
- data/lib/baretest/run/cli.rb +1 -1
- data/lib/baretest/run/errors.rb +20 -18
- data/lib/baretest/run/minimal.rb +1 -1
- data/lib/baretest/run/profile.rb +1 -1
- data/lib/baretest/run/spec.rb +1 -1
- data/lib/baretest/run/tap.rb +1 -1
- data/lib/baretest/run/xml.rb +1 -1
- data/lib/baretest/run.rb +1 -1
- data/lib/baretest/setup.rb +1 -1
- data/lib/baretest/skipped/assertion.rb +1 -1
- data/lib/baretest/skipped/suite.rb +1 -1
- data/lib/baretest/skipped.rb +1 -1
- data/lib/baretest/suite.rb +4 -2
- data/lib/baretest/version.rb +2 -2
- data/lib/baretest.rb +13 -9
- data/lib/{baretest/utilities.rb → ruby/kernel.rb} +2 -2
- data/test/suite/lib/baretest/assertion/support.rb +2 -2
- data/test/suite/lib/baretest/assertion.rb +1 -1
- data/test/suite/lib/baretest/irb_mode.rb +1 -1
- data/test/suite/lib/baretest/run/cli.rb +1 -1
- data/test/suite/lib/baretest/run/errors.rb +1 -1
- data/test/suite/lib/baretest/run/interactive.rb +1 -1
- data/test/suite/lib/baretest/run/spec.rb +1 -1
- data/test/suite/lib/baretest/run/tap.rb +1 -1
- data/test/suite/lib/baretest/run/xml.rb +1 -1
- data/test/suite/lib/baretest/run.rb +1 -1
- data/test/suite/lib/baretest/suite.rb +1 -1
- data/test/suite/lib/baretest.rb +1 -1
- metadata +7 -5
data/LICENSE.txt
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
The BareTest library is copyrighted free software by Stefan Rusterholz.
|
2
|
-
You can redistribute it and/or modify it under the terms
|
2
|
+
You can redistribute it and/or modify it under the terms of the conditions
|
3
3
|
below (also known as the 'Ruby License'):
|
4
4
|
|
5
5
|
1. You may make and give away verbatim copies of the source form of the
|
@@ -38,11 +38,11 @@ below (also known as the 'Ruby License'):
|
|
38
38
|
d) make other distribution arrangements with the author.
|
39
39
|
|
40
40
|
4. You may modify and include the part of the software into any other
|
41
|
-
software (possibly commercial).
|
41
|
+
software (possibly commercial).
|
42
42
|
|
43
|
-
5. The scripts and library files supplied as input to or produced as
|
43
|
+
5. The scripts and library files supplied as input to or produced as
|
44
44
|
output from the software do not automatically fall under the
|
45
|
-
copyright of the software, but belong to whomever generated them,
|
45
|
+
copyright of the software, but belong to whomever generated them,
|
46
46
|
and may be sold commercially, and may be aggregated with this
|
47
47
|
software.
|
48
48
|
|
data/MANIFEST.txt
CHANGED
@@ -5,7 +5,9 @@ bin/baretest
|
|
5
5
|
doc/baretest.rdoc
|
6
6
|
doc/mocking_stubbing_test_doubles.rdoc
|
7
7
|
doc/quickref.rdoc
|
8
|
+
doc/whats_going_on.rdoc
|
8
9
|
doc/writing_tests.rdoc
|
10
|
+
examples/test.rake
|
9
11
|
examples/tests/irb_mode/failures.rb
|
10
12
|
examples/tests/mock_developer/test/helper/mocks.rb
|
11
13
|
examples/tests/mock_developer/test/setup.rb
|
@@ -14,7 +16,6 @@ examples/tests/overview/test.rb
|
|
14
16
|
examples/tests/variations/variations_01.rb
|
15
17
|
examples/tests/variations/variations_02.rb
|
16
18
|
examples/tests/variations/variations_03.rb
|
17
|
-
examples/test.rake
|
18
19
|
lib/baretest.rb
|
19
20
|
lib/baretest/assertion.rb
|
20
21
|
lib/baretest/assertion/context.rb
|
@@ -24,6 +25,7 @@ lib/baretest/assertion/support.rb
|
|
24
25
|
lib/baretest/irb_mode.rb
|
25
26
|
lib/baretest/layout.rb
|
26
27
|
lib/baretest/mocha.rb
|
28
|
+
lib/baretest/rr.rb
|
27
29
|
lib/baretest/run.rb
|
28
30
|
lib/baretest/run/cli.rb
|
29
31
|
lib/baretest/run/errors.rb
|
@@ -37,8 +39,8 @@ lib/baretest/skipped.rb
|
|
37
39
|
lib/baretest/skipped/assertion.rb
|
38
40
|
lib/baretest/skipped/suite.rb
|
39
41
|
lib/baretest/suite.rb
|
40
|
-
lib/baretest/utilities.rb
|
41
42
|
lib/baretest/version.rb
|
43
|
+
lib/ruby/kernel.rb
|
42
44
|
test/external/bootstraptest.rb
|
43
45
|
test/external/bootstrapwrap.rb
|
44
46
|
test/helper/mocks.rb
|
data/README.rdoc
CHANGED
data/bin/baretest
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
3
|
#--
|
4
|
-
# Copyright 2009 by Stefan Rusterholz.
|
4
|
+
# Copyright 2009-2010 by Stefan Rusterholz.
|
5
5
|
# All rights reserved.
|
6
6
|
# See LICENSE.txt for permissions.
|
7
7
|
#++
|
@@ -132,22 +132,12 @@ end
|
|
132
132
|
|
133
133
|
|
134
134
|
# Load the setup file, all helper files and all test files
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
else
|
142
|
-
load(setup_path) if setup_path && File.exist?(setup_path)
|
143
|
-
ARGV.each { |path|
|
144
|
-
if File.directory?(path) then
|
145
|
-
Dir.glob("#{path}/**/*.rb") { load(path) }
|
146
|
-
else
|
147
|
-
Dir.glob(path) { load(path) }
|
148
|
-
end
|
149
|
-
}
|
150
|
-
end
|
135
|
+
BareTest.load_standard_test_files(
|
136
|
+
:verbose => $VERBOSE,
|
137
|
+
:setup_path => setup_path,
|
138
|
+
:files => (ARGV.empty? ? nil : ARGV),
|
139
|
+
:chdir => '.'
|
140
|
+
)
|
151
141
|
|
152
142
|
|
153
143
|
|
data/doc/quickref.rdoc
CHANGED
@@ -161,7 +161,7 @@ can alternatively be used with named arguments:
|
|
161
161
|
Failure: case_equal(String, 1)
|
162
162
|
|
163
163
|
* equal_unordered(expected, actual, message=nil)
|
164
|
-
Description: Compares unordered enumerables, on the enumerable it uses each,
|
164
|
+
Description: Compares unordered enumerables, on the enumerable it uses each,
|
165
165
|
on the items it uses hash and eql?
|
166
166
|
Success: equal_unordered([1,2], [2,1])
|
167
167
|
Failure: equal_unordered([1,2], [2,1,2])
|
@@ -0,0 +1,35 @@
|
|
1
|
+
With the following test definition:
|
2
|
+
BareTest.suite "A"
|
3
|
+
setup do
|
4
|
+
@x = 1
|
5
|
+
end
|
6
|
+
|
7
|
+
suite "B" do
|
8
|
+
setup do
|
9
|
+
@y = 2
|
10
|
+
end
|
11
|
+
|
12
|
+
assert "Foo" do
|
13
|
+
@x == foo(@y)
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
Is this approximately as if you'd execute following code:
|
19
|
+
context = Assertion::Context.new
|
20
|
+
context.instance_eval do @x = 1 end # setup of suite A
|
21
|
+
context.instance_eval do @y = 1 end # setup of suite B
|
22
|
+
# execute assertion
|
23
|
+
success = false
|
24
|
+
begin
|
25
|
+
success = context.instance_eval do @x = foo(@y) end # assertion
|
26
|
+
status = success ? :success : :failure
|
27
|
+
rescue *PassthroughExceptions
|
28
|
+
Kernel.raise # let those exceptions pass unhandled
|
29
|
+
rescue Assertion::Failure
|
30
|
+
status = :failure
|
31
|
+
rescue Assertion::Skip
|
32
|
+
status = :skipped
|
33
|
+
rescue Exception # catch-all for the rest
|
34
|
+
status = :error
|
35
|
+
end
|
data/examples/test.rake
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
#--
|
2
|
-
# Copyright 2009 by Stefan Rusterholz.
|
2
|
+
# Copyright 2009-2010 by Stefan Rusterholz.
|
3
3
|
# All rights reserved.
|
4
4
|
# See LICENSE.txt for permissions.
|
5
5
|
#++
|
@@ -41,18 +41,18 @@ namespace :test do
|
|
41
41
|
}.find { |path|
|
42
42
|
File.directory?(path)
|
43
43
|
}
|
44
|
-
|
44
|
+
|
45
45
|
# Verify that the test directory exists
|
46
46
|
raise "Could not determine test directory, please adapt this rake task to " \
|
47
47
|
"your directory structure first (see rake test:structure)." unless test_dir
|
48
|
-
|
48
|
+
|
49
49
|
# Load all test definitions
|
50
50
|
BareTest.load_standard_test_files(
|
51
51
|
:verbose => $VERBOSE,
|
52
52
|
:setup_file => 'test/setup.rb',
|
53
53
|
:chdir => File.dirname(test_dir) # must chdir to 1 above the 'test' dir
|
54
54
|
)
|
55
|
-
|
55
|
+
|
56
56
|
# Run all tests
|
57
57
|
format = ENV["FORMAT"] || 'cli'
|
58
58
|
interactive = ENV["INTERACTIVE"] == 'true'
|
@@ -1,5 +1,5 @@
|
|
1
1
|
#--
|
2
|
-
# Copyright 2009 by Stefan Rusterholz.
|
2
|
+
# Copyright 2009-2010 by Stefan Rusterholz.
|
3
3
|
# All rights reserved.
|
4
4
|
# See LICENSE.txt for permissions.
|
5
5
|
#++
|
@@ -118,7 +118,7 @@ module BareTest
|
|
118
118
|
else
|
119
119
|
true
|
120
120
|
end
|
121
|
-
rescue *::BareTest::Assertion::PassthroughExceptions
|
121
|
+
rescue ::BareTest::Assertion::Failure, *::BareTest::Assertion::PassthroughExceptions
|
122
122
|
::Kernel.raise
|
123
123
|
rescue => exception
|
124
124
|
failure "Expected block to raise #{exception_class}, but it raised #{exception.class}."
|
@@ -129,7 +129,7 @@ module BareTest
|
|
129
129
|
# Will raise a Failure if the given block raises.
|
130
130
|
def raises_nothing
|
131
131
|
yield
|
132
|
-
rescue *::BareTest::Assertion::PassthroughExceptions
|
132
|
+
rescue ::BareTest::Assertion::Failure, *::BareTest::Assertion::PassthroughExceptions
|
133
133
|
::Kernel.raise
|
134
134
|
rescue Exception => exception
|
135
135
|
failure "Expected block to raise nothing, but it raised #{exception.class}."
|
@@ -142,7 +142,7 @@ module BareTest
|
|
142
142
|
# of the possible rounding differences.
|
143
143
|
def within_delta(a, b, delta)
|
144
144
|
(a-b).abs < delta
|
145
|
-
rescue *::BareTest::Assertion::PassthroughExceptions
|
145
|
+
rescue ::BareTest::Assertion::Failure, *::BareTest::Assertion::PassthroughExceptions
|
146
146
|
::Kernel.raise
|
147
147
|
rescue Exception => e
|
148
148
|
failure "Could not compare %p with %p due to %s", a, b, e
|
@@ -209,7 +209,7 @@ module BareTest
|
|
209
209
|
end
|
210
210
|
true
|
211
211
|
|
212
|
-
rescue *::BareTest::Assertion::PassthroughExceptions
|
212
|
+
rescue ::BareTest::Assertion::Failure, *::BareTest::Assertion::PassthroughExceptions
|
213
213
|
::Kernel.raise
|
214
214
|
rescue Exception => e
|
215
215
|
failure "Could not compare %p with %p due to %s", expected, actual, e
|
@@ -232,7 +232,7 @@ module BareTest
|
|
232
232
|
end
|
233
233
|
true
|
234
234
|
|
235
|
-
rescue *::BareTest::Assertion::PassthroughExceptions
|
235
|
+
rescue ::BareTest::Assertion::Failure, *::BareTest::Assertion::PassthroughExceptions
|
236
236
|
::Kernel.raise
|
237
237
|
rescue Exception => e
|
238
238
|
failure "Could not compare %p with %p due to %s", expected, actual, e
|
@@ -255,7 +255,7 @@ module BareTest
|
|
255
255
|
end
|
256
256
|
true
|
257
257
|
|
258
|
-
rescue *::BareTest::Assertion::PassthroughExceptions
|
258
|
+
rescue ::BareTest::Assertion::Failure, *::BareTest::Assertion::PassthroughExceptions
|
259
259
|
::Kernel.raise
|
260
260
|
rescue Exception => e
|
261
261
|
failure "Could not compare %p with %p due to %s", expected, actual, e
|
@@ -278,7 +278,7 @@ module BareTest
|
|
278
278
|
end
|
279
279
|
true
|
280
280
|
|
281
|
-
rescue *::BareTest::Assertion::PassthroughExceptions
|
281
|
+
rescue ::BareTest::Assertion::Failure, *::BareTest::Assertion::PassthroughExceptions
|
282
282
|
::Kernel.raise
|
283
283
|
rescue Exception => e
|
284
284
|
failure "Could not compare %p with %p due to %s", expected, actual, e
|
@@ -309,7 +309,7 @@ module BareTest
|
|
309
309
|
end
|
310
310
|
true
|
311
311
|
|
312
|
-
rescue *::BareTest::Assertion::PassthroughExceptions
|
312
|
+
rescue ::BareTest::Assertion::Failure, *::BareTest::Assertion::PassthroughExceptions
|
313
313
|
::Kernel.raise
|
314
314
|
rescue Exception => e
|
315
315
|
failure "Could not compare %p with %p due to %s", expected, actual, e
|
@@ -327,7 +327,7 @@ module BareTest
|
|
327
327
|
end
|
328
328
|
true
|
329
329
|
|
330
|
-
rescue *::BareTest::Assertion::PassthroughExceptions
|
330
|
+
rescue ::BareTest::Assertion::Failure, *::BareTest::Assertion::PassthroughExceptions
|
331
331
|
::Kernel.raise
|
332
332
|
rescue Exception => e
|
333
333
|
failure "Could not test whether %p is a child of %p due to %s", actual, expected, e
|
data/lib/baretest/assertion.rb
CHANGED
data/lib/baretest/irb_mode.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
#--
|
2
|
-
# Copyright 2009 by Stefan Rusterholz.
|
2
|
+
# Copyright 2009-2010 by Stefan Rusterholz.
|
3
3
|
# All rights reserved.
|
4
4
|
# See LICENSE.txt for permissions.
|
5
5
|
#++
|
@@ -88,9 +88,9 @@ module BareTest
|
|
88
88
|
|
89
89
|
# Prints the original assertion's backtrace
|
90
90
|
def bt!(size=nil)
|
91
|
-
if @
|
91
|
+
if @__original__.exception then
|
92
92
|
size ||= caller.size+3
|
93
|
-
puts @
|
93
|
+
puts @__original__.exception.backtrace[0..-size]
|
94
94
|
else
|
95
95
|
puts "No exception occurred, therefore no backtrace is available"
|
96
96
|
end
|
@@ -113,19 +113,19 @@ module BareTest
|
|
113
113
|
|
114
114
|
# Prints a string of the original assertion's nesting within suites
|
115
115
|
def description
|
116
|
-
puts @
|
116
|
+
puts @__original__.description
|
117
117
|
end
|
118
118
|
|
119
119
|
# Prints a string of the original assertion's nesting within suites
|
120
120
|
def nesting
|
121
|
-
puts @
|
121
|
+
puts @__original__.suite.ancestors[0..-2].reverse.map { |s| s.description }.join(' > ')
|
122
122
|
end
|
123
123
|
|
124
124
|
# Prints the code of the assertion
|
125
125
|
# Be aware that this relies on your code being properly indented.
|
126
126
|
def code!
|
127
|
-
if code = @
|
128
|
-
puts(insert_line_numbers(code, @
|
127
|
+
if code = @__original__.code then
|
128
|
+
puts(insert_line_numbers(code, @__original__.line-1))
|
129
129
|
else
|
130
130
|
puts "Code could not be extracted"
|
131
131
|
end
|
data/lib/baretest/layout.rb
CHANGED
data/lib/baretest/rr.rb
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
# Load this file and get integration with the "rr" mocking framework.
|
2
|
+
|
3
|
+
require 'rr'
|
4
|
+
|
5
|
+
class BareTest::Assertion::Context
|
6
|
+
include RR::Adapters::RRMethods
|
7
|
+
end
|
8
|
+
|
9
|
+
BareTest.toplevel_suite.teardown do
|
10
|
+
begin
|
11
|
+
RR.verify
|
12
|
+
rescue RR::Errors => e
|
13
|
+
@reason = e.message
|
14
|
+
@status = :failure
|
15
|
+
end
|
16
|
+
end
|
data/lib/baretest/run/cli.rb
CHANGED
data/lib/baretest/run/errors.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
#--
|
2
|
-
# Copyright 2009 by Stefan Rusterholz.
|
2
|
+
# Copyright 2009-2010 by Stefan Rusterholz.
|
3
3
|
# All rights reserved.
|
4
4
|
# See LICENSE.txt for permissions.
|
5
5
|
#++
|
@@ -16,29 +16,31 @@ module BareTest
|
|
16
16
|
module Errors # :nodoc:
|
17
17
|
def run_all
|
18
18
|
@depth = 0
|
19
|
-
puts "Running all tests, reporting errors"
|
20
|
-
super
|
19
|
+
puts "Running all tests, reporting only errors and failures"
|
21
20
|
start = Time.now
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
puts "#{' '*@depth+suite.description} (#{suite.assertions.size} tests, #{suite.skipped.size} skipped)"
|
28
|
-
@depth += 1
|
29
|
-
super # run the suite
|
30
|
-
@depth -= 1
|
21
|
+
super
|
22
|
+
stop = Time.now
|
23
|
+
printf "\Ran #{@count[:test]} tests (#{@count[:pending]} pending) in %.1fs\n" \
|
24
|
+
"#{@count[:failure]} failures and #{@count[:error]} errors encountered.\n",
|
25
|
+
(stop-start)
|
31
26
|
end
|
32
27
|
|
33
28
|
def run_test(assertion, setup)
|
34
29
|
rv = super # run the assertion
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
30
|
+
if rv.status == :failure then
|
31
|
+
head = "FAILURE in #{rv.description}"
|
32
|
+
message = rv.reason || "no failure reason given"
|
33
|
+
stack = "#{rv.file}:#{rv.line}"
|
34
|
+
elsif rv.exception then
|
35
|
+
size = caller.size+5
|
36
|
+
head = "ERROR in #{rv.description}"
|
37
|
+
message = rv.exception.message || "no exception message given"
|
38
|
+
stack = rv.exception.backtrace[0..-size].join("\n ")
|
39
|
+
else
|
40
|
+
return
|
41
41
|
end
|
42
|
+
|
43
|
+
puts head, " "+message.gsub(/\n/, "\n "), " "+stack, ""
|
42
44
|
end
|
43
45
|
end
|
44
46
|
end
|
data/lib/baretest/run/minimal.rb
CHANGED
data/lib/baretest/run/profile.rb
CHANGED
data/lib/baretest/run/spec.rb
CHANGED
data/lib/baretest/run/tap.rb
CHANGED
data/lib/baretest/run/xml.rb
CHANGED
data/lib/baretest/run.rb
CHANGED
data/lib/baretest/setup.rb
CHANGED
data/lib/baretest/skipped.rb
CHANGED
data/lib/baretest/suite.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
#--
|
2
|
-
# Copyright 2009 by Stefan Rusterholz.
|
2
|
+
# Copyright 2009-2010 by Stefan Rusterholz.
|
3
3
|
# All rights reserved.
|
4
4
|
# See LICENSE.txt for permissions.
|
5
5
|
#++
|
@@ -147,7 +147,7 @@ module BareTest
|
|
147
147
|
@setup[component] ||= []
|
148
148
|
|
149
149
|
case multiplexed
|
150
|
-
when String
|
150
|
+
when nil, String
|
151
151
|
@setup[component] << ::BareTest::Setup.new(component, multiplexed, nil, block)
|
152
152
|
when Array
|
153
153
|
multiplexed.each do |substitute|
|
@@ -157,6 +157,8 @@ module BareTest
|
|
157
157
|
multiplexed.each do |substitute, value|
|
158
158
|
@setup[component] << BareTest::Setup.new(component, substitute, value, block)
|
159
159
|
end
|
160
|
+
else
|
161
|
+
raise TypeError, "multiplexed must be an instance of NilClass, String, Array or Hash, but #{multiplexed.class} given."
|
160
162
|
end
|
161
163
|
elsif component || multiplexed
|
162
164
|
raise ArgumentError, "With component or multiplexed given, a block must be provided too."
|
data/lib/baretest/version.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
#--
|
2
|
-
# Copyright 2009 by Stefan Rusterholz.
|
2
|
+
# Copyright 2009-2010 by Stefan Rusterholz.
|
3
3
|
# All rights reserved.
|
4
4
|
# See LICENSE.txt for permissions.
|
5
5
|
#++
|
@@ -18,7 +18,7 @@ module BareTest
|
|
18
18
|
MINOR = 2
|
19
19
|
|
20
20
|
# The tiny version number
|
21
|
-
TINY =
|
21
|
+
TINY = 4
|
22
22
|
|
23
23
|
# The version as a string
|
24
24
|
def self.to_s
|
data/lib/baretest.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
#--
|
2
|
-
# Copyright 2009 by Stefan Rusterholz.
|
2
|
+
# Copyright 2009-2010 by Stefan Rusterholz.
|
3
3
|
# All rights reserved.
|
4
4
|
# See LICENSE.txt for permissions.
|
5
5
|
#++
|
@@ -10,8 +10,8 @@ require 'baretest/assertion'
|
|
10
10
|
require 'baretest/irb_mode'
|
11
11
|
require 'baretest/run'
|
12
12
|
require 'baretest/suite'
|
13
|
-
require 'baretest/utilities'
|
14
13
|
require 'baretest/version'
|
14
|
+
require 'ruby/kernel'
|
15
15
|
# See bottom for more requires
|
16
16
|
|
17
17
|
|
@@ -45,15 +45,19 @@ module BareTest
|
|
45
45
|
verbose = opts.delete(:verbose)
|
46
46
|
setup_path = opts.delete(:setup_path) || 'test/setup.rb'
|
47
47
|
chdir = opts.delete(:chdir) || '.'
|
48
|
+
files = opts.delete(:files) || ['test/{suite,unit,integration,system}/**/*.rb']
|
48
49
|
Dir.chdir(chdir) do
|
49
50
|
load(setup_path) if File.exist?(setup_path)
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
51
|
+
files.each do |glob|
|
52
|
+
glob = "#{glob}/**/*.rb" if File.directory?(glob)
|
53
|
+
Dir.glob(glob) { |path|
|
54
|
+
helper_path = path.sub(%r{^test/(suite|unit|integration|system)/}, 'test/helper/\1/')
|
55
|
+
puts(File.exist?(helper_path) ? "Loading helper file #{helper_path}" : "No helper file #{helper_path} to load") if verbose
|
56
|
+
load(helper_path) if File.exist?(helper_path)
|
57
|
+
puts "Loading test file #{path}" if verbose
|
58
|
+
load(path)
|
59
|
+
}
|
60
|
+
end
|
57
61
|
end
|
58
62
|
end
|
59
63
|
|
@@ -1,5 +1,5 @@
|
|
1
1
|
#--
|
2
|
-
# Copyright 2009 by Stefan Rusterholz.
|
2
|
+
# Copyright 2009-2010 by Stefan Rusterholz.
|
3
3
|
# All rights reserved.
|
4
4
|
# See LICENSE.txt for permissions.
|
5
5
|
#++
|
@@ -40,4 +40,4 @@ module Kernel
|
|
40
40
|
end
|
41
41
|
|
42
42
|
module_function :require_path, :expanded_require_path, :load_into
|
43
|
-
end
|
43
|
+
end
|
@@ -1,5 +1,5 @@
|
|
1
1
|
#--
|
2
|
-
# Copyright 2009 by Stefan Rusterholz.
|
2
|
+
# Copyright 2009-2010 by Stefan Rusterholz.
|
3
3
|
# All rights reserved.
|
4
4
|
# See LICENSE.txt for permissions.
|
5
5
|
#++
|
@@ -20,7 +20,7 @@ module BareTest
|
|
20
20
|
unless failed then
|
21
21
|
failure "Expected the block to fail, but it returned a true value."
|
22
22
|
end
|
23
|
-
|
23
|
+
|
24
24
|
true
|
25
25
|
end
|
26
26
|
end
|
data/test/suite/lib/baretest.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: baretest
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Stefan Rusterholz
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date:
|
12
|
+
date: 2010-01-14 00:00:00 +01:00
|
13
13
|
default_executable:
|
14
14
|
dependencies: []
|
15
15
|
|
@@ -31,7 +31,9 @@ files:
|
|
31
31
|
- doc/baretest.rdoc
|
32
32
|
- doc/mocking_stubbing_test_doubles.rdoc
|
33
33
|
- doc/quickref.rdoc
|
34
|
+
- doc/whats_going_on.rdoc
|
34
35
|
- doc/writing_tests.rdoc
|
36
|
+
- examples/test.rake
|
35
37
|
- examples/tests/irb_mode/failures.rb
|
36
38
|
- examples/tests/mock_developer/test/helper/mocks.rb
|
37
39
|
- examples/tests/mock_developer/test/setup.rb
|
@@ -40,7 +42,6 @@ files:
|
|
40
42
|
- examples/tests/variations/variations_01.rb
|
41
43
|
- examples/tests/variations/variations_02.rb
|
42
44
|
- examples/tests/variations/variations_03.rb
|
43
|
-
- examples/test.rake
|
44
45
|
- lib/baretest.rb
|
45
46
|
- lib/baretest/assertion.rb
|
46
47
|
- lib/baretest/assertion/context.rb
|
@@ -50,6 +51,7 @@ files:
|
|
50
51
|
- lib/baretest/irb_mode.rb
|
51
52
|
- lib/baretest/layout.rb
|
52
53
|
- lib/baretest/mocha.rb
|
54
|
+
- lib/baretest/rr.rb
|
53
55
|
- lib/baretest/run.rb
|
54
56
|
- lib/baretest/run/cli.rb
|
55
57
|
- lib/baretest/run/errors.rb
|
@@ -63,8 +65,8 @@ files:
|
|
63
65
|
- lib/baretest/skipped/assertion.rb
|
64
66
|
- lib/baretest/skipped/suite.rb
|
65
67
|
- lib/baretest/suite.rb
|
66
|
-
- lib/baretest/utilities.rb
|
67
68
|
- lib/baretest/version.rb
|
69
|
+
- lib/ruby/kernel.rb
|
68
70
|
- test/external/bootstraptest.rb
|
69
71
|
- test/external/bootstrapwrap.rb
|
70
72
|
- test/helper/mocks.rb
|
@@ -94,7 +96,7 @@ rdoc_options:
|
|
94
96
|
- --tab-width
|
95
97
|
- "2"
|
96
98
|
- -t
|
97
|
-
- baretest-0.2.
|
99
|
+
- baretest-0.2.4 Documentation
|
98
100
|
require_paths:
|
99
101
|
- lib
|
100
102
|
required_ruby_version: !ruby/object:Gem::Requirement
|