rspec-unit 0.9.22 → 0.9.23
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/Gemfile +2 -2
- data/Gemfile.lock +11 -12
- data/README.md +4 -32
- data/Rakefile +1 -1
- data/VERSION.yml +1 -1
- data/lib/rspec/unit/assertions.rb +6 -5
- data/lib/rspec/unit/test_case.rb +1 -1
- data/spec/test_case_spec.rb +3 -4
- metadata +4 -4
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -10,25 +10,24 @@ GEM
|
|
10
10
|
rubyforge (>= 2.0.0)
|
11
11
|
json_pure (1.4.6)
|
12
12
|
rake (0.8.7)
|
13
|
-
|
14
|
-
|
15
|
-
rspec-
|
16
|
-
rspec-
|
17
|
-
|
18
|
-
rspec-
|
19
|
-
rspec-expectations (2.0.0.beta.22)
|
13
|
+
rspec (2.0.0.rc)
|
14
|
+
rspec-core (= 2.0.0.rc)
|
15
|
+
rspec-expectations (= 2.0.0.rc)
|
16
|
+
rspec-mocks (= 2.0.0.rc)
|
17
|
+
rspec-core (2.0.0.rc)
|
18
|
+
rspec-expectations (2.0.0.rc)
|
20
19
|
diff-lcs (>= 1.1.2)
|
21
|
-
rspec-mocks (2.0.0.
|
22
|
-
rspec-core (= 2.0.0.
|
23
|
-
rspec-expectations (= 2.0.0.
|
20
|
+
rspec-mocks (2.0.0.rc)
|
21
|
+
rspec-core (= 2.0.0.rc)
|
22
|
+
rspec-expectations (= 2.0.0.rc)
|
24
23
|
rubyforge (2.0.4)
|
25
24
|
json_pure (>= 1.1.7)
|
26
25
|
|
27
26
|
PLATFORMS
|
27
|
+
java
|
28
28
|
ruby
|
29
29
|
|
30
30
|
DEPENDENCIES
|
31
31
|
jeweler (>= 1.4.0)
|
32
32
|
rake (>= 0.8.7)
|
33
|
-
|
34
|
-
rspec (= 2.0.0.beta.22)
|
33
|
+
rspec (= 2.0.0.rc)
|
data/README.md
CHANGED
@@ -58,7 +58,7 @@ in many ways.
|
|
58
58
|
|
59
59
|
Currently, test/unit compatibility is much more limited than in
|
60
60
|
RSpec 1. The goal is not to make RSpec 2 a drop-in replacement for
|
61
|
-
test/unit; rather,
|
61
|
+
test/unit; rather, I have three more limited goals:
|
62
62
|
|
63
63
|
1. to allow RSpec 2 examples to easily make use of test/unit assertions
|
64
64
|
in cases where those assertions are valuable, or where assertions
|
@@ -66,8 +66,9 @@ test/unit; rather, we have two more limited goals:
|
|
66
66
|
2. to make it *easy* for a project to switch an existing test/unit
|
67
67
|
suite over to run under RSpec, as the start of a gradual, piecemeal
|
68
68
|
conversion to RSpec.
|
69
|
+
3. to demonstrate how to extend RSpec 2.
|
69
70
|
|
70
|
-
As such, there are some things
|
71
|
+
As such, there are some things that are not supported:
|
71
72
|
|
72
73
|
* The top-level module name is different. For example, one requires
|
73
74
|
`rspec/unit` rather than `test/unit`, and extends `RSpec::Unit::TestCase`
|
@@ -79,37 +80,8 @@ As such, there are some things we don''t support:
|
|
79
80
|
* All test output and summaries are in RSpec style; test/unit-compatible
|
80
81
|
output is not supported.
|
81
82
|
|
82
|
-
|
83
|
-
|
84
|
-
I originally wrote this test/unit compatibility gem for Micronaut, a
|
85
|
-
lightweight RSpec clone by Chad Humphries. Micronaut has been rolled
|
86
|
-
into RSpec as the core of RSpec 2, and I was able to move the test/unit
|
87
|
-
compatibility over with minimal changes.
|
88
|
-
|
89
|
-
The point of this gem is not that I think test/unit is a better way
|
90
|
-
to write tests than the RSpec style. I admit that I'm a TDD oldtimer
|
91
|
-
who sees RSpec as mostly a cosmetic (rather than fundamental) change,
|
92
|
-
but that doesn't mean it's not an important change. My curmudgeonly
|
93
|
-
nature has its limits, and I do find specs a big improvement.
|
94
|
-
|
95
|
-
So why rspec-unit? Three reasons:
|
96
|
-
|
97
|
-
1. I wanted to show off the generality of Micronaut's (and now RSpec's)
|
98
|
-
architecture. I hope rspec-unit can serve as an example for anyone
|
99
|
-
who wants to experiment with new ways of expressing tests and specs
|
100
|
-
on top of RSpec.
|
101
|
-
2. Many projects with existing test/unit test suites might want to
|
102
|
-
benefit from the [metadata goodness][metadata] in RSpec 2, or begin
|
103
|
-
a gradual, piecemeal change to an RSpec style. That's pretty
|
104
|
-
easy to do with rspec-unit.
|
105
|
-
3. Even when writing specs and examples, I frequently encounter
|
106
|
-
cases where an assertion is more expressive than a `should`
|
107
|
-
expression. It's nice just to have assertions supported within
|
108
|
-
RSpec examples.
|
83
|
+
I will certainly consider supporting those things if there is demand.
|
109
84
|
|
110
|
-
[uth]: http://blog.thinkrelevance.com/2009/4/1/micronaut-innovation-under-the-hood
|
111
|
-
[metadata]: http://blog.thinkrelevance.com/2009/3/26/introducing-micronaut-a-lightweight-bdd-framework
|
112
|
-
|
113
85
|
## To Do
|
114
86
|
|
115
87
|
It would be nice to try using the assertion code from minitest,
|
data/Rakefile
CHANGED
@@ -12,7 +12,7 @@ begin
|
|
12
12
|
gem.rubyforge_project = "rspec-unit"
|
13
13
|
gem.add_dependency('rspec', '~> 2.0')
|
14
14
|
gem.has_rdoc = false
|
15
|
-
gem.files = FileList["[A-Z]*", "{bin,lib,spec}/**/*"]
|
15
|
+
gem.files = FileList["[A-Z]*", "{bin,lib,spec}/**/*"].exclude('**/*.rbc')
|
16
16
|
gem.rubyforge_project = 'glv'
|
17
17
|
# gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
|
18
18
|
end
|
data/VERSION.yml
CHANGED
@@ -366,7 +366,8 @@ EOT
|
|
366
366
|
end
|
367
367
|
end
|
368
368
|
|
369
|
-
UncaughtThrow = {
|
369
|
+
UncaughtThrow = {ArgumentError => /^uncaught throw :?(.+)$/,
|
370
|
+
NameError => /^uncaught throw \`(.+)\'$/,
|
370
371
|
ThreadError => /^uncaught throw \`(.+)\' in thread /} #`
|
371
372
|
|
372
373
|
##
|
@@ -390,11 +391,11 @@ EOT
|
|
390
391
|
end
|
391
392
|
full_message = build_message(message, "<?> should have been thrown.", expected_symbol)
|
392
393
|
assert_block(full_message){caught}
|
393
|
-
rescue NameError, ThreadError => error
|
394
|
+
rescue ArgumentError, NameError, ThreadError => error
|
394
395
|
if UncaughtThrow[error.class] !~ error.message
|
395
396
|
raise error
|
396
397
|
end
|
397
|
-
full_message = build_message(message, "<?> expected to be thrown but\n<?> was thrown.", expected_symbol, $1.
|
398
|
+
full_message = build_message(message, "<?> expected to be thrown but\n<?> was thrown.", expected_symbol, $1.to_sym)
|
398
399
|
flunk(full_message)
|
399
400
|
end
|
400
401
|
end
|
@@ -414,11 +415,11 @@ EOT
|
|
414
415
|
assert(block_given?, "Should have passed a block to assert_nothing_thrown")
|
415
416
|
begin
|
416
417
|
proc.call
|
417
|
-
rescue NameError, ThreadError => error
|
418
|
+
rescue ArgumentError, NameError, ThreadError => error
|
418
419
|
if UncaughtThrow[error.class] !~ error.message
|
419
420
|
raise error
|
420
421
|
end
|
421
|
-
full_message = build_message(message, "<?> was thrown when nothing was expected", $1.
|
422
|
+
full_message = build_message(message, "<?> was thrown when nothing was expected", $1.to_sym)
|
422
423
|
flunk(full_message)
|
423
424
|
end
|
424
425
|
assert(true, "Expected nothing to be thrown")
|
data/lib/rspec/unit/test_case.rb
CHANGED
data/spec/test_case_spec.rb
CHANGED
@@ -229,7 +229,7 @@ describe "RSpec::Unit::TestCase" do
|
|
229
229
|
|
230
230
|
it "sets :caller" do
|
231
231
|
@foo.metadata[:example_group][:caller].first.should =~ Regexp.new(Regexp.escape(@foo.metadata[:example_group][:location]))
|
232
|
-
@foo.metadata[:example_group][:caller].size.should
|
232
|
+
@foo.metadata[:example_group][:caller].size.should be_>(@caller_at_foo_definition.size)
|
233
233
|
end
|
234
234
|
|
235
235
|
it "has nil for :block and :describes" do
|
@@ -302,15 +302,14 @@ describe "RSpec::Unit::TestCase" do
|
|
302
302
|
def test_baz; end
|
303
303
|
end
|
304
304
|
test_baz_metadata[:example_group].should == @foo.metadata[:example_group]
|
305
|
-
test_baz_metadata[:behaviour].should == @foo.metadata[:example_group]
|
306
305
|
end
|
307
306
|
|
308
307
|
it "sets :caller" do
|
309
308
|
@foo.class_eval do
|
310
309
|
def test_baz; end
|
311
310
|
end
|
312
|
-
test_baz_metadata[:caller].first.should
|
313
|
-
test_baz_metadata[:caller].size.should
|
311
|
+
test_baz_metadata[:caller].first.should match(/^#{Regexp.escape(@foo.examples.first.metadata[:location])}/)
|
312
|
+
test_baz_metadata[:caller].size.should be_>(caller.size)
|
314
313
|
end
|
315
314
|
|
316
315
|
it "records test_info metadata for next test method" do
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rspec-unit
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 21
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 9
|
9
|
-
-
|
10
|
-
version: 0.9.
|
9
|
+
- 23
|
10
|
+
version: 0.9.23
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Glenn Vanderburg
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2010-
|
18
|
+
date: 2010-10-07 00:00:00 -05:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|