rspec 1.3.0 → 1.3.1
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/History.rdoc +17 -0
- data/README.rdoc +10 -23
- data/examples/passing/shared_example_group_example.rb +0 -36
- data/examples/passing/simple_matcher_example.rb +3 -3
- data/features/interop/test_but_not_test_unit.feature +1 -1
- data/features/interop/test_case_with_should_methods.feature +1 -1
- data/geminstaller.yml +3 -2
- data/lib/spec/deprecation.rb +2 -1
- data/lib/spec/dsl/main.rb +1 -0
- data/lib/spec/example/example_group_methods.rb +6 -1
- data/lib/spec/example/subject.rb +9 -3
- data/lib/spec/interop/test/unit/testsuite_adapter.rb +2 -0
- data/lib/spec/matchers/operator_matcher.rb +6 -1
- data/lib/spec/matchers/pretty.rb +2 -2
- data/lib/spec/matchers/simple_matcher.rb +2 -1
- data/lib/spec/matchers/throw_symbol.rb +2 -2
- data/lib/spec/matchers.rb +1 -1
- data/lib/spec/mocks/proxy.rb +2 -0
- data/lib/spec/runner/backtrace_tweaker.rb +3 -2
- data/lib/spec/runner/configuration.rb +8 -0
- data/lib/spec/runner/options.rb +2 -1
- data/lib/spec/version.rb +1 -1
- data/spec/spec/dsl/main_spec.rb +10 -2
- data/spec/spec/example/example_group_methods_spec.rb +19 -0
- data/spec/spec/example/example_group_proxy_spec.rb +1 -1
- data/spec/spec/example/example_group_spec.rb +1 -12
- data/spec/spec/example/example_matcher_spec.rb +3 -4
- data/spec/spec/example/subject_spec.rb +7 -0
- data/spec/spec/expectations/wrap_expectation_spec.rb +2 -1
- data/spec/spec/matchers/have_spec.rb +278 -293
- data/spec/spec/matchers/match_array_spec.rb +8 -1
- data/spec/spec/matchers/simple_matcher_spec.rb +51 -44
- data/spec/spec/matchers/throw_symbol_spec.rb +3 -3
- data/spec/spec/mocks/bug_report_496_spec.rb +2 -4
- data/spec/spec_helper.rb +2 -1
- metadata +94 -32
|
@@ -66,7 +66,8 @@ the extra elements were: [5, 6]
|
|
|
66
66
|
MESSAGE
|
|
67
67
|
end
|
|
68
68
|
|
|
69
|
-
|
|
69
|
+
it "should not sort items in the error message if they don't all respond to <=>" do
|
|
70
|
+
with_ruby 1.8 do
|
|
70
71
|
lambda {
|
|
71
72
|
[UnsortableObject.new(2), UnsortableObject.new(1)].should =~ [UnsortableObject.new(4), UnsortableObject.new(3)]
|
|
72
73
|
}.should fail_with(<<-MESSAGE)
|
|
@@ -76,6 +77,7 @@ the missing elements were: [4, 3]
|
|
|
76
77
|
the extra elements were: [2, 1]
|
|
77
78
|
MESSAGE
|
|
78
79
|
end
|
|
80
|
+
end
|
|
79
81
|
|
|
80
82
|
it "should accurately report extra elements when there are duplicates" do
|
|
81
83
|
lambda {
|
|
@@ -97,6 +99,11 @@ the missing elements were: [1]
|
|
|
97
99
|
MESSAGE
|
|
98
100
|
end
|
|
99
101
|
|
|
102
|
+
it "should work with subclasses of Array" do
|
|
103
|
+
class SuperArray < Array; end
|
|
104
|
+
SuperArray.new([1,2,3]).should =~ SuperArray.new([3,2,1])
|
|
105
|
+
end
|
|
106
|
+
|
|
100
107
|
end
|
|
101
108
|
|
|
102
109
|
describe "should_not =~ [:with, :multiple, :args]" do
|
|
@@ -3,6 +3,13 @@ require 'spec_helper'
|
|
|
3
3
|
module Spec
|
|
4
4
|
module Matchers
|
|
5
5
|
describe SimpleMatcher do
|
|
6
|
+
before { Spec.stub(:deprecate) }
|
|
7
|
+
|
|
8
|
+
it "is deprecated" do
|
|
9
|
+
Spec.should_receive(:deprecate)
|
|
10
|
+
simple_matcher("foo") {}
|
|
11
|
+
end
|
|
12
|
+
|
|
6
13
|
it "should pass match arg to block" do
|
|
7
14
|
actual = nil
|
|
8
15
|
matcher = simple_matcher("message") do |given| actual = given end
|
|
@@ -35,59 +42,59 @@ module Spec
|
|
|
35
42
|
matcher.matches?("anything").should be_true
|
|
36
43
|
end.should fail_with(/expected: 3/)
|
|
37
44
|
end
|
|
38
|
-
end
|
|
39
45
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
46
|
+
describe "with arity of 2" do
|
|
47
|
+
it "should provide the matcher so you can access its messages" do
|
|
48
|
+
provided_matcher = nil
|
|
49
|
+
matcher = simple_matcher("thing") do |given, matcher|
|
|
50
|
+
provided_matcher = matcher
|
|
51
|
+
end
|
|
52
|
+
matcher.matches?("anything")
|
|
53
|
+
provided_matcher.should equal(matcher)
|
|
45
54
|
end
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
matcher.failure_message
|
|
55
|
+
|
|
56
|
+
it "should support a custom failure message" do
|
|
57
|
+
matcher = simple_matcher("thing") do |given, matcher|
|
|
58
|
+
matcher.failure_message = "custom message"
|
|
59
|
+
end
|
|
60
|
+
matcher.matches?("other")
|
|
61
|
+
matcher.failure_message.should == "custom message"
|
|
53
62
|
end
|
|
54
|
-
matcher.matches?("other")
|
|
55
|
-
matcher.failure_message.should == "custom message"
|
|
56
|
-
end
|
|
57
63
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
64
|
+
it "should complain when asked for a failure message if you don't give it a description or a message" do
|
|
65
|
+
matcher = simple_matcher do |given, matcher| end
|
|
66
|
+
matcher.matches?("other")
|
|
67
|
+
matcher.failure_message.should =~ /No description provided/
|
|
68
|
+
end
|
|
63
69
|
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
70
|
+
it "should support a custom negative failure message" do
|
|
71
|
+
matcher = simple_matcher("thing") do |given, matcher|
|
|
72
|
+
matcher.negative_failure_message = "custom message"
|
|
73
|
+
end
|
|
74
|
+
matcher.matches?("other")
|
|
75
|
+
matcher.negative_failure_message.should == "custom message"
|
|
76
|
+
end
|
|
77
|
+
|
|
78
|
+
it "should complain when asked for a negative failure message if you don't give it a description or a message" do
|
|
79
|
+
matcher = simple_matcher do |given, matcher| end
|
|
80
|
+
matcher.matches?("other")
|
|
81
|
+
matcher.negative_failure_message.should =~ /No description provided/
|
|
67
82
|
end
|
|
68
|
-
matcher.matches?("other")
|
|
69
|
-
matcher.negative_failure_message.should == "custom message"
|
|
70
|
-
end
|
|
71
|
-
|
|
72
|
-
it "should complain when asked for a negative failure message if you don't give it a description or a message" do
|
|
73
|
-
matcher = simple_matcher do |given, matcher| end
|
|
74
|
-
matcher.matches?("other")
|
|
75
|
-
matcher.negative_failure_message.should =~ /No description provided/
|
|
76
|
-
end
|
|
77
83
|
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
84
|
+
it "should support a custom description" do
|
|
85
|
+
matcher = simple_matcher("thing") do |given, matcher|
|
|
86
|
+
matcher.description = "custom message"
|
|
87
|
+
end
|
|
88
|
+
matcher.matches?("description")
|
|
89
|
+
matcher.description.should == "custom message"
|
|
81
90
|
end
|
|
82
|
-
matcher.matches?("description")
|
|
83
|
-
matcher.description.should == "custom message"
|
|
84
|
-
end
|
|
85
91
|
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
92
|
+
it "should tell you no description was provided when it doesn't receive one" do
|
|
93
|
+
matcher = simple_matcher do end
|
|
94
|
+
matcher.description.should =~ /No description provided/
|
|
95
|
+
end
|
|
89
96
|
end
|
|
97
|
+
|
|
90
98
|
end
|
|
91
|
-
|
|
92
99
|
end
|
|
93
|
-
end
|
|
100
|
+
end
|
|
@@ -4,7 +4,7 @@ module Spec
|
|
|
4
4
|
module Matchers
|
|
5
5
|
describe ThrowSymbol do
|
|
6
6
|
describe "with no args" do
|
|
7
|
-
let(:matcher) {
|
|
7
|
+
let(:matcher) { throw_symbol }
|
|
8
8
|
|
|
9
9
|
it "matches if any Symbol is thrown" do
|
|
10
10
|
matcher.matches?(lambda{ throw :sym }).should be_true
|
|
@@ -30,7 +30,7 @@ module Spec
|
|
|
30
30
|
end
|
|
31
31
|
|
|
32
32
|
describe "with a symbol" do
|
|
33
|
-
let(:matcher) {
|
|
33
|
+
let(:matcher) { throw_symbol(:sym) }
|
|
34
34
|
|
|
35
35
|
it "matches if correct Symbol is thrown" do
|
|
36
36
|
matcher.matches?(lambda{ throw :sym }).should be_true
|
|
@@ -75,7 +75,7 @@ module Spec
|
|
|
75
75
|
end
|
|
76
76
|
|
|
77
77
|
describe "with a symbol and an arg" do
|
|
78
|
-
let(:matcher) {
|
|
78
|
+
let(:matcher) { throw_symbol(:sym, "a") }
|
|
79
79
|
|
|
80
80
|
it "matches if correct Symbol and args are thrown" do
|
|
81
81
|
matcher.matches?(lambda{ throw :sym, "a" }).should be_true
|
|
@@ -9,10 +9,8 @@ module BugReport496
|
|
|
9
9
|
|
|
10
10
|
describe "a message expectation on a base class object" do
|
|
11
11
|
it "should correctly pick up message sent to it subclass" do
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
SubClass.new
|
|
15
|
-
end
|
|
12
|
+
BaseClass.should_receive(:new).once
|
|
13
|
+
SubClass.new
|
|
16
14
|
end
|
|
17
15
|
end
|
|
18
16
|
end
|
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,13 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: rspec
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
|
|
4
|
+
hash: 25
|
|
5
|
+
prerelease: false
|
|
6
|
+
segments:
|
|
7
|
+
- 1
|
|
8
|
+
- 3
|
|
9
|
+
- 1
|
|
10
|
+
version: 1.3.1
|
|
5
11
|
platform: ruby
|
|
6
12
|
authors:
|
|
7
13
|
- RSpec Development Team
|
|
@@ -9,69 +15,119 @@ autorequire:
|
|
|
9
15
|
bindir: bin
|
|
10
16
|
cert_chain: []
|
|
11
17
|
|
|
12
|
-
date: 2010-
|
|
18
|
+
date: 2010-10-09 00:00:00 -05:00
|
|
13
19
|
default_executable:
|
|
14
20
|
dependencies:
|
|
15
21
|
- !ruby/object:Gem::Dependency
|
|
16
|
-
name:
|
|
22
|
+
name: rubyforge
|
|
23
|
+
prerelease: false
|
|
24
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
|
25
|
+
none: false
|
|
26
|
+
requirements:
|
|
27
|
+
- - ">="
|
|
28
|
+
- !ruby/object:Gem::Version
|
|
29
|
+
hash: 7
|
|
30
|
+
segments:
|
|
31
|
+
- 2
|
|
32
|
+
- 0
|
|
33
|
+
- 4
|
|
34
|
+
version: 2.0.4
|
|
17
35
|
type: :development
|
|
18
|
-
|
|
19
|
-
|
|
36
|
+
version_requirements: *id001
|
|
37
|
+
- !ruby/object:Gem::Dependency
|
|
38
|
+
name: cucumber
|
|
39
|
+
prerelease: false
|
|
40
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
|
41
|
+
none: false
|
|
20
42
|
requirements:
|
|
21
43
|
- - ">="
|
|
22
44
|
- !ruby/object:Gem::Version
|
|
45
|
+
hash: 13
|
|
46
|
+
segments:
|
|
47
|
+
- 0
|
|
48
|
+
- 3
|
|
23
49
|
version: "0.3"
|
|
24
|
-
|
|
50
|
+
type: :development
|
|
51
|
+
version_requirements: *id002
|
|
25
52
|
- !ruby/object:Gem::Dependency
|
|
26
53
|
name: fakefs
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
54
|
+
prerelease: false
|
|
55
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
|
56
|
+
none: false
|
|
30
57
|
requirements:
|
|
31
58
|
- - ">="
|
|
32
59
|
- !ruby/object:Gem::Version
|
|
60
|
+
hash: 21
|
|
61
|
+
segments:
|
|
62
|
+
- 0
|
|
63
|
+
- 2
|
|
64
|
+
- 1
|
|
33
65
|
version: 0.2.1
|
|
34
|
-
|
|
66
|
+
type: :development
|
|
67
|
+
version_requirements: *id003
|
|
35
68
|
- !ruby/object:Gem::Dependency
|
|
36
69
|
name: syntax
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
70
|
+
prerelease: false
|
|
71
|
+
requirement: &id004 !ruby/object:Gem::Requirement
|
|
72
|
+
none: false
|
|
40
73
|
requirements:
|
|
41
74
|
- - ">="
|
|
42
75
|
- !ruby/object:Gem::Version
|
|
76
|
+
hash: 15
|
|
77
|
+
segments:
|
|
78
|
+
- 1
|
|
79
|
+
- 0
|
|
43
80
|
version: "1.0"
|
|
44
|
-
|
|
81
|
+
type: :development
|
|
82
|
+
version_requirements: *id004
|
|
45
83
|
- !ruby/object:Gem::Dependency
|
|
46
84
|
name: diff-lcs
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
85
|
+
prerelease: false
|
|
86
|
+
requirement: &id005 !ruby/object:Gem::Requirement
|
|
87
|
+
none: false
|
|
50
88
|
requirements:
|
|
51
89
|
- - ">="
|
|
52
90
|
- !ruby/object:Gem::Version
|
|
91
|
+
hash: 23
|
|
92
|
+
segments:
|
|
93
|
+
- 1
|
|
94
|
+
- 1
|
|
95
|
+
- 2
|
|
53
96
|
version: 1.1.2
|
|
54
|
-
|
|
97
|
+
type: :development
|
|
98
|
+
version_requirements: *id005
|
|
55
99
|
- !ruby/object:Gem::Dependency
|
|
56
100
|
name: heckle
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
101
|
+
prerelease: false
|
|
102
|
+
requirement: &id006 !ruby/object:Gem::Requirement
|
|
103
|
+
none: false
|
|
60
104
|
requirements:
|
|
61
105
|
- - ">="
|
|
62
106
|
- !ruby/object:Gem::Version
|
|
107
|
+
hash: 1
|
|
108
|
+
segments:
|
|
109
|
+
- 1
|
|
110
|
+
- 4
|
|
111
|
+
- 3
|
|
63
112
|
version: 1.4.3
|
|
64
|
-
|
|
113
|
+
type: :development
|
|
114
|
+
version_requirements: *id006
|
|
65
115
|
- !ruby/object:Gem::Dependency
|
|
66
116
|
name: hoe
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
117
|
+
prerelease: false
|
|
118
|
+
requirement: &id007 !ruby/object:Gem::Requirement
|
|
119
|
+
none: false
|
|
70
120
|
requirements:
|
|
71
121
|
- - ">="
|
|
72
122
|
- !ruby/object:Gem::Version
|
|
73
|
-
|
|
74
|
-
|
|
123
|
+
hash: 19
|
|
124
|
+
segments:
|
|
125
|
+
- 2
|
|
126
|
+
- 6
|
|
127
|
+
- 2
|
|
128
|
+
version: 2.6.2
|
|
129
|
+
type: :development
|
|
130
|
+
version_requirements: *id007
|
|
75
131
|
description: Behaviour Driven Development for Ruby.
|
|
76
132
|
email:
|
|
77
133
|
- rspec-devel@rubyforge.org
|
|
@@ -477,7 +533,7 @@ licenses: []
|
|
|
477
533
|
post_install_message: |
|
|
478
534
|
**************************************************
|
|
479
535
|
|
|
480
|
-
Thank you for installing rspec-1.3.
|
|
536
|
+
Thank you for installing rspec-1.3.1
|
|
481
537
|
|
|
482
538
|
Please be sure to read History.rdoc and Upgrade.rdoc
|
|
483
539
|
for useful information about this release.
|
|
@@ -490,23 +546,29 @@ rdoc_options:
|
|
|
490
546
|
require_paths:
|
|
491
547
|
- lib
|
|
492
548
|
required_ruby_version: !ruby/object:Gem::Requirement
|
|
549
|
+
none: false
|
|
493
550
|
requirements:
|
|
494
551
|
- - ">="
|
|
495
552
|
- !ruby/object:Gem::Version
|
|
553
|
+
hash: 3
|
|
554
|
+
segments:
|
|
555
|
+
- 0
|
|
496
556
|
version: "0"
|
|
497
|
-
version:
|
|
498
557
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
558
|
+
none: false
|
|
499
559
|
requirements:
|
|
500
560
|
- - ">="
|
|
501
561
|
- !ruby/object:Gem::Version
|
|
562
|
+
hash: 3
|
|
563
|
+
segments:
|
|
564
|
+
- 0
|
|
502
565
|
version: "0"
|
|
503
|
-
version:
|
|
504
566
|
requirements: []
|
|
505
567
|
|
|
506
568
|
rubyforge_project: rspec
|
|
507
|
-
rubygems_version: 1.3.
|
|
569
|
+
rubygems_version: 1.3.7
|
|
508
570
|
signing_key:
|
|
509
571
|
specification_version: 3
|
|
510
|
-
summary: rspec 1.3.
|
|
572
|
+
summary: rspec 1.3.1
|
|
511
573
|
test_files: []
|
|
512
574
|
|