rspec-expectations 2.12.1 → 2.13.0
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/Changelog.md +31 -0
- data/README.md +1 -1
- data/features/built_in_matchers/be.feature +6 -4
- data/features/built_in_matchers/be_within.feature +3 -1
- data/features/built_in_matchers/cover.feature +2 -0
- data/features/built_in_matchers/end_with.feature +2 -0
- data/features/built_in_matchers/equality.feature +9 -15
- data/features/built_in_matchers/exist.feature +2 -0
- data/features/built_in_matchers/expect_error.feature +14 -8
- data/features/built_in_matchers/have.feature +11 -5
- data/features/built_in_matchers/include.feature +53 -0
- data/features/built_in_matchers/match.feature +2 -0
- data/features/built_in_matchers/operators.feature +17 -11
- data/features/built_in_matchers/predicates.feature +21 -13
- data/features/built_in_matchers/respond_to.feature +7 -1
- data/features/built_in_matchers/satisfy.feature +2 -0
- data/features/built_in_matchers/start_with.feature +2 -0
- data/features/built_in_matchers/throw_symbol.feature +6 -0
- data/features/built_in_matchers/types.feature +8 -6
- data/lib/rspec/expectations/deprecation.rb +1 -1
- data/lib/rspec/expectations/differ.rb +8 -8
- data/lib/rspec/expectations/fail_with.rb +17 -3
- data/lib/rspec/expectations/syntax.rb +46 -0
- data/lib/rspec/expectations/version.rb +1 -1
- data/lib/rspec/matchers/built_in/be.rb +7 -3
- data/lib/rspec/matchers/built_in/be_within.rb +13 -4
- data/lib/rspec/matchers/built_in/change.rb +2 -2
- data/lib/rspec/matchers/built_in/equal.rb +5 -1
- data/lib/rspec/matchers/built_in/exist.rb +1 -1
- data/lib/rspec/matchers/built_in/have.rb +8 -8
- data/lib/rspec/matchers/built_in/include.rb +19 -3
- data/lib/rspec/matchers/built_in/respond_to.rb +1 -1
- data/lib/rspec/matchers/extensions/instance_eval_with_args.rb +1 -1
- data/lib/rspec/matchers/matcher.rb +4 -3
- data/lib/rspec/matchers/operator_matcher.rb +1 -1
- data/lib/rspec/matchers/pretty.rb +5 -1
- data/spec/rspec/expectations/differ_spec.rb +8 -15
- data/spec/rspec/expectations/expectation_target_spec.rb +18 -8
- data/spec/rspec/expectations/extensions/kernel_spec.rb +15 -15
- data/spec/rspec/expectations/fail_with_spec.rb +41 -16
- data/spec/rspec/expectations/handler_spec.rb +13 -13
- data/spec/rspec/expectations/syntax_spec.rb +70 -8
- data/spec/rspec/matchers/base_matcher_spec.rb +14 -12
- data/spec/rspec/matchers/be_close_spec.rb +1 -1
- data/spec/rspec/matchers/be_instance_of_spec.rb +14 -8
- data/spec/rspec/matchers/be_kind_of_spec.rb +12 -8
- data/spec/rspec/matchers/be_spec.rb +212 -148
- data/spec/rspec/matchers/be_within_spec.rb +91 -42
- data/spec/rspec/matchers/change_spec.rb +52 -38
- data/spec/rspec/matchers/configuration_spec.rb +19 -15
- data/spec/rspec/matchers/cover_spec.rb +19 -19
- data/spec/rspec/matchers/description_generation_spec.rb +86 -86
- data/spec/rspec/matchers/dsl_spec.rb +7 -7
- data/spec/rspec/matchers/eq_spec.rb +17 -11
- data/spec/rspec/matchers/eql_spec.rb +10 -10
- data/spec/rspec/matchers/equal_spec.rb +27 -9
- data/spec/rspec/matchers/exist_spec.rb +35 -21
- data/spec/rspec/matchers/has_spec.rb +33 -29
- data/spec/rspec/matchers/have_spec.rb +165 -151
- data/spec/rspec/matchers/include_matcher_integration_spec.rb +30 -0
- data/spec/rspec/matchers/include_spec.rb +282 -124
- data/spec/rspec/matchers/match_array_spec.rb +90 -49
- data/spec/rspec/matchers/match_spec.rb +21 -21
- data/spec/rspec/matchers/matcher_spec.rb +85 -48
- data/spec/rspec/matchers/matchers_spec.rb +12 -6
- data/spec/rspec/matchers/method_missing_spec.rb +5 -1
- data/spec/rspec/matchers/operator_matcher_spec.rb +216 -237
- data/spec/rspec/matchers/raise_error_spec.rb +132 -132
- data/spec/rspec/matchers/respond_to_spec.rb +109 -112
- data/spec/rspec/matchers/satisfy_spec.rb +16 -16
- data/spec/rspec/matchers/start_with_end_with_spec.rb +36 -32
- data/spec/rspec/matchers/throw_symbol_spec.rb +24 -24
- data/spec/rspec/matchers/yield_spec.rb +7 -7
- data/spec/spec_helper.rb +46 -19
- data/spec/support/in_sub_process.rb +27 -20
- metadata +81 -83
@@ -1,181 +1,185 @@
|
|
1
1
|
require "spec_helper"
|
2
2
|
|
3
|
-
describe "
|
3
|
+
describe "expect(...).to start_with" do
|
4
4
|
it_behaves_like "an RSpec matcher", :valid_value => "ab", :invalid_value => "bc" do
|
5
5
|
let(:matcher) { start_with("a") }
|
6
6
|
end
|
7
7
|
|
8
8
|
context "with a string" do
|
9
9
|
it "passes if it matches the start of the actual string" do
|
10
|
-
"this string".
|
10
|
+
expect("this string").to start_with "this str"
|
11
11
|
end
|
12
12
|
|
13
13
|
it "fails if it does not match the start of the actual string" do
|
14
14
|
expect {
|
15
|
-
"this string".
|
15
|
+
expect("this string").to start_with "that str"
|
16
16
|
}.to fail_with("expected \"this string\" to start with \"that str\"")
|
17
17
|
end
|
18
18
|
end
|
19
19
|
|
20
20
|
context "with an array" do
|
21
21
|
it "passes if it is the first element of the array" do
|
22
|
-
[0, 1, 2].
|
22
|
+
expect([0, 1, 2]).to start_with 0
|
23
23
|
end
|
24
24
|
|
25
25
|
it "passes if the first elements of the array match" do
|
26
|
-
[0, 1, 2].
|
26
|
+
expect([0, 1, 2]).to start_with 0, 1
|
27
27
|
end
|
28
28
|
|
29
29
|
it "fails if it does not match the first element of the array" do
|
30
30
|
expect {
|
31
|
-
[0, 1, 2].
|
31
|
+
expect([0, 1, 2]).to start_with 2
|
32
32
|
}.to fail_with("expected [0, 1, 2] to start with 2")
|
33
33
|
end
|
34
34
|
|
35
35
|
it "fails if it the first elements of the array do not match" do
|
36
36
|
expect {
|
37
|
-
[0, 1, 2].
|
37
|
+
expect([0, 1, 2]).to start_with 1, 2
|
38
38
|
}.to fail_with("expected [0, 1, 2] to start with [1, 2]")
|
39
39
|
end
|
40
40
|
end
|
41
41
|
|
42
42
|
context "with an object that does not respond to :[]" do
|
43
43
|
it "raises an ArgumentError" do
|
44
|
-
expect {
|
44
|
+
expect {
|
45
|
+
expect(Object.new).to start_with 0
|
46
|
+
}.to raise_error(ArgumentError, /does not respond to :\[\]/)
|
45
47
|
end
|
46
48
|
end
|
47
49
|
|
48
50
|
context "with a hash" do
|
49
51
|
it "raises an ArgumentError if trying to match more than one element" do
|
50
52
|
expect{
|
51
|
-
{:a => 'b', :b => 'b', :c => 'c'}.
|
53
|
+
expect({:a => 'b', :b => 'b', :c => 'c'}).to start_with({:a => 'b', :b => 'b'})
|
52
54
|
}.to raise_error(ArgumentError, /does not have ordered elements/)
|
53
55
|
end
|
54
56
|
end
|
55
57
|
end
|
56
58
|
|
57
|
-
describe "
|
59
|
+
describe "expect(...).to_not start_with" do
|
58
60
|
context "with a string" do
|
59
61
|
it "passes if it does not match the start of the actual string" do
|
60
|
-
"this string".
|
62
|
+
expect("this string").not_to start_with "that str"
|
61
63
|
end
|
62
64
|
|
63
65
|
it "fails if it does match the start of the actual string" do
|
64
66
|
expect {
|
65
|
-
"this string".
|
67
|
+
expect("this string").not_to start_with "this str"
|
66
68
|
}.to fail_with("expected \"this string\" not to start with \"this str\"")
|
67
69
|
end
|
68
70
|
end
|
69
71
|
|
70
72
|
context "with an array" do
|
71
73
|
it "passes if it is not the first element of the array" do
|
72
|
-
[0, 1, 2].
|
74
|
+
expect([0, 1, 2]).not_to start_with 2
|
73
75
|
end
|
74
76
|
|
75
77
|
it "passes if the first elements of the array do not match" do
|
76
|
-
[0, 1, 2].
|
78
|
+
expect([0, 1, 2]).not_to start_with 1, 2
|
77
79
|
end
|
78
80
|
|
79
81
|
it "fails if it matches the first element of the array" do
|
80
82
|
expect {
|
81
|
-
[0, 1, 2].
|
83
|
+
expect([0, 1, 2]).not_to start_with 0
|
82
84
|
}.to fail_with("expected [0, 1, 2] not to start with 0")
|
83
85
|
end
|
84
86
|
|
85
87
|
it "fails if it the first elements of the array match" do
|
86
88
|
expect {
|
87
|
-
[0, 1, 2].
|
89
|
+
expect([0, 1, 2]).not_to start_with 0, 1
|
88
90
|
}.to fail_with("expected [0, 1, 2] not to start with [0, 1]")
|
89
91
|
end
|
90
92
|
end
|
91
93
|
end
|
92
94
|
|
93
|
-
describe "
|
95
|
+
describe "expect(...).to end_with" do
|
94
96
|
it_behaves_like "an RSpec matcher", :valid_value => "ab", :invalid_value => "bc" do
|
95
97
|
let(:matcher) { end_with("b") }
|
96
98
|
end
|
97
99
|
|
98
100
|
context "with a string" do
|
99
101
|
it "passes if it matches the end of the actual string" do
|
100
|
-
"this string".
|
102
|
+
expect("this string").to end_with "is string"
|
101
103
|
end
|
102
104
|
|
103
105
|
it "fails if it does not match the end of the actual string" do
|
104
106
|
expect {
|
105
|
-
"this string".
|
107
|
+
expect("this string").to end_with "is stringy"
|
106
108
|
}.to fail_with("expected \"this string\" to end with \"is stringy\"")
|
107
109
|
end
|
108
110
|
end
|
109
111
|
|
110
112
|
context "with an array" do
|
111
113
|
it "passes if it is the last element of the array" do
|
112
|
-
[0, 1, 2].
|
114
|
+
expect([0, 1, 2]).to end_with 2
|
113
115
|
end
|
114
116
|
|
115
117
|
it "passes if the last elements of the array match" do
|
116
|
-
[0, 1, 2].
|
118
|
+
expect([0, 1, 2]).to end_with [1, 2]
|
117
119
|
end
|
118
120
|
|
119
121
|
it "fails if it does not match the last element of the array" do
|
120
122
|
expect {
|
121
|
-
[0, 1, 2].
|
123
|
+
expect([0, 1, 2]).to end_with 1
|
122
124
|
}.to fail_with("expected [0, 1, 2] to end with 1")
|
123
125
|
end
|
124
126
|
|
125
127
|
it "fails if it the last elements of the array do not match" do
|
126
128
|
expect {
|
127
|
-
[0, 1, 2].
|
129
|
+
expect([0, 1, 2]).to end_with [0, 1]
|
128
130
|
}.to fail_with("expected [0, 1, 2] to end with [0, 1]")
|
129
131
|
end
|
130
132
|
end
|
131
133
|
|
132
134
|
context "with an object that does not respond to :[]" do
|
133
135
|
it "raises an error if expected value can't be indexed'" do
|
134
|
-
expect {
|
136
|
+
expect {
|
137
|
+
expect(Object.new).to end_with 0
|
138
|
+
}.to raise_error(ArgumentError, /does not respond to :\[\]/)
|
135
139
|
end
|
136
140
|
end
|
137
141
|
|
138
142
|
context "with a hash" do
|
139
143
|
it "raises an ArgumentError if trying to match more than one element" do
|
140
144
|
expect{
|
141
|
-
{:a => 'b', :b => 'b', :c => 'c'}.
|
145
|
+
expect({:a => 'b', :b => 'b', :c => 'c'}).to end_with({:a => 'b', :b =>'b'})
|
142
146
|
}.to raise_error(ArgumentError, /does not have ordered elements/)
|
143
147
|
end
|
144
148
|
end
|
145
149
|
|
146
150
|
end
|
147
151
|
|
148
|
-
describe "
|
152
|
+
describe "expect(...).to_not end_with" do
|
149
153
|
context "with a sting" do
|
150
154
|
it "passes if it does not match the end of the actual string" do
|
151
|
-
"this string".
|
155
|
+
expect("this string").not_to end_with "stringy"
|
152
156
|
end
|
153
157
|
|
154
158
|
it "fails if it matches the end of the actual string" do
|
155
159
|
expect {
|
156
|
-
"this string".
|
160
|
+
expect("this string").not_to end_with "string"
|
157
161
|
}.to fail_with("expected \"this string\" not to end with \"string\"")
|
158
162
|
end
|
159
163
|
end
|
160
164
|
|
161
165
|
context "an array" do
|
162
166
|
it "passes if it is not the last element of the array" do
|
163
|
-
[0, 1, 2].
|
167
|
+
expect([0, 1, 2]).not_to end_with 1
|
164
168
|
end
|
165
169
|
|
166
170
|
it "passes if the last elements of the array do not match" do
|
167
|
-
[0, 1, 2].
|
171
|
+
expect([0, 1, 2]).not_to end_with [0, 1]
|
168
172
|
end
|
169
173
|
|
170
174
|
it "fails if it matches the last element of the array" do
|
171
175
|
expect {
|
172
|
-
[0, 1, 2].
|
176
|
+
expect([0, 1, 2]).not_to end_with 2
|
173
177
|
}.to fail_with("expected [0, 1, 2] not to end with 2")
|
174
178
|
end
|
175
179
|
|
176
180
|
it "fails if it the last elements of the array match" do
|
177
181
|
expect {
|
178
|
-
[0, 1, 2].
|
182
|
+
expect([0, 1, 2]).not_to end_with [1, 2]
|
179
183
|
}.to fail_with("expected [0, 1, 2] not to end with [1, 2]")
|
180
184
|
end
|
181
185
|
end
|
@@ -11,21 +11,21 @@ module RSpec::Matchers::BuiltIn
|
|
11
11
|
before(:each) { @matcher = throw_symbol }
|
12
12
|
|
13
13
|
it "matches if any Symbol is thrown" do
|
14
|
-
@matcher.matches?(lambda{ throw :sym }).
|
14
|
+
expect(@matcher.matches?(lambda{ throw :sym })).to be_true
|
15
15
|
end
|
16
16
|
it "matches if any Symbol is thrown with an arg" do
|
17
|
-
@matcher.matches?(lambda{ throw :sym, "argument" }).
|
17
|
+
expect(@matcher.matches?(lambda{ throw :sym, "argument" })).to be_true
|
18
18
|
end
|
19
19
|
it "does not match if no Symbol is thrown" do
|
20
|
-
@matcher.matches?(lambda{ }).
|
20
|
+
expect(@matcher.matches?(lambda{ })).to be_false
|
21
21
|
end
|
22
22
|
it "provides a failure message" do
|
23
23
|
@matcher.matches?(lambda{})
|
24
|
-
@matcher.failure_message_for_should.
|
24
|
+
expect(@matcher.failure_message_for_should).to eq "expected a Symbol to be thrown, got nothing"
|
25
25
|
end
|
26
26
|
it "provides a negative failure message" do
|
27
27
|
@matcher.matches?(lambda{ throw :sym})
|
28
|
-
@matcher.failure_message_for_should_not.
|
28
|
+
expect(@matcher.failure_message_for_should_not).to eq "expected no Symbol to be thrown, got :sym"
|
29
29
|
end
|
30
30
|
end
|
31
31
|
|
@@ -33,32 +33,32 @@ module RSpec::Matchers::BuiltIn
|
|
33
33
|
before(:each) { @matcher = throw_symbol(:sym) }
|
34
34
|
|
35
35
|
it "matches if correct Symbol is thrown" do
|
36
|
-
@matcher.matches?(lambda{ throw :sym }).
|
36
|
+
expect(@matcher.matches?(lambda{ throw :sym })).to be_true
|
37
37
|
end
|
38
38
|
it "matches if correct Symbol is thrown with an arg" do
|
39
|
-
@matcher.matches?(lambda{ throw :sym, "argument" }).
|
39
|
+
expect(@matcher.matches?(lambda{ throw :sym, "argument" })).to be_true
|
40
40
|
end
|
41
41
|
it "does not match if no Symbol is thrown" do
|
42
|
-
@matcher.matches?(lambda{ }).
|
42
|
+
expect(@matcher.matches?(lambda{ })).to be_false
|
43
43
|
end
|
44
44
|
it "does not match if correct Symbol is thrown" do
|
45
|
-
@matcher.matches?(lambda{ throw :other_sym }).
|
45
|
+
expect(@matcher.matches?(lambda{ throw :other_sym })).to be_false
|
46
46
|
end
|
47
47
|
it "provides a failure message when no Symbol is thrown" do
|
48
48
|
@matcher.matches?(lambda{})
|
49
|
-
@matcher.failure_message_for_should.
|
49
|
+
expect(@matcher.failure_message_for_should).to eq "expected :sym to be thrown, got nothing"
|
50
50
|
end
|
51
51
|
it "provides a failure message when wrong Symbol is thrown" do
|
52
52
|
@matcher.matches?(lambda{ throw :other_sym })
|
53
|
-
@matcher.failure_message_for_should.
|
53
|
+
expect(@matcher.failure_message_for_should).to eq "expected :sym to be thrown, got :other_sym"
|
54
54
|
end
|
55
55
|
it "provides a negative failure message" do
|
56
56
|
@matcher.matches?(lambda{ throw :sym })
|
57
|
-
@matcher.failure_message_for_should_not.
|
57
|
+
expect(@matcher.failure_message_for_should_not).to eq "expected :sym not to be thrown, got :sym"
|
58
58
|
end
|
59
59
|
it "only matches NameErrors raised by uncaught throws" do
|
60
60
|
expect {
|
61
|
-
@matcher.matches?(lambda{ sym }).
|
61
|
+
expect(@matcher.matches?(lambda{ sym })).to be_false
|
62
62
|
}.to raise_error(NameError)
|
63
63
|
end
|
64
64
|
end
|
@@ -67,43 +67,43 @@ module RSpec::Matchers::BuiltIn
|
|
67
67
|
before(:each) { @matcher = throw_symbol(:sym, "a") }
|
68
68
|
|
69
69
|
it "matches if correct Symbol and args are thrown" do
|
70
|
-
@matcher.matches?(lambda{ throw :sym, "a" }).
|
70
|
+
expect(@matcher.matches?(lambda{ throw :sym, "a" })).to be_true
|
71
71
|
end
|
72
72
|
it "does not match if nothing is thrown" do
|
73
|
-
@matcher.matches?(lambda{ }).
|
73
|
+
expect(@matcher.matches?(lambda{ })).to be_false
|
74
74
|
end
|
75
75
|
it "does not match if other Symbol is thrown" do
|
76
|
-
@matcher.matches?(lambda{ throw :other_sym, "a" }).
|
76
|
+
expect(@matcher.matches?(lambda{ throw :other_sym, "a" })).to be_false
|
77
77
|
end
|
78
78
|
it "does not match if no arg is thrown" do
|
79
|
-
@matcher.matches?(lambda{ throw :sym }).
|
79
|
+
expect(@matcher.matches?(lambda{ throw :sym })).to be_false
|
80
80
|
end
|
81
81
|
it "does not match if wrong arg is thrown" do
|
82
|
-
@matcher.matches?(lambda{ throw :sym, "b" }).
|
82
|
+
expect(@matcher.matches?(lambda{ throw :sym, "b" })).to be_false
|
83
83
|
end
|
84
84
|
it "provides a failure message when no Symbol is thrown" do
|
85
85
|
@matcher.matches?(lambda{})
|
86
|
-
@matcher.failure_message_for_should.
|
86
|
+
expect(@matcher.failure_message_for_should).to eq %q[expected :sym with "a" to be thrown, got nothing]
|
87
87
|
end
|
88
88
|
it "provides a failure message when wrong Symbol is thrown" do
|
89
89
|
@matcher.matches?(lambda{ throw :other_sym })
|
90
|
-
@matcher.failure_message_for_should.
|
90
|
+
expect(@matcher.failure_message_for_should).to eq %q[expected :sym with "a" to be thrown, got :other_sym]
|
91
91
|
end
|
92
92
|
it "provides a failure message when wrong arg is thrown" do
|
93
93
|
@matcher.matches?(lambda{ throw :sym, "b" })
|
94
|
-
@matcher.failure_message_for_should.
|
94
|
+
expect(@matcher.failure_message_for_should).to eq %q[expected :sym with "a" to be thrown, got :sym with "b"]
|
95
95
|
end
|
96
96
|
it "provides a failure message when no arg is thrown" do
|
97
97
|
@matcher.matches?(lambda{ throw :sym })
|
98
|
-
@matcher.failure_message_for_should.
|
98
|
+
expect(@matcher.failure_message_for_should).to eq %q[expected :sym with "a" to be thrown, got :sym with no argument]
|
99
99
|
end
|
100
100
|
it "provides a negative failure message" do
|
101
101
|
@matcher.matches?(lambda{ throw :sym })
|
102
|
-
@matcher.failure_message_for_should_not.
|
102
|
+
expect(@matcher.failure_message_for_should_not).to eq %q[expected :sym with "a" not to be thrown, got :sym with no argument]
|
103
103
|
end
|
104
104
|
it "only matches NameErrors raised by uncaught throws" do
|
105
105
|
expect {
|
106
|
-
@matcher.matches?(lambda{ sym }).
|
106
|
+
expect(@matcher.matches?(lambda{ sym })).to be_false
|
107
107
|
}.to raise_error(NameError)
|
108
108
|
end
|
109
109
|
it "raises other errors" do
|
@@ -44,7 +44,7 @@ describe "yield_control matcher" do
|
|
44
44
|
end
|
45
45
|
|
46
46
|
it 'has a description' do
|
47
|
-
yield_control.description.
|
47
|
+
expect(yield_control.description).to eq("yield control")
|
48
48
|
end
|
49
49
|
|
50
50
|
describe "expect {...}.to yield_control" do
|
@@ -106,7 +106,7 @@ describe "yield_with_no_args matcher" do
|
|
106
106
|
end
|
107
107
|
|
108
108
|
it 'has a description' do
|
109
|
-
yield_with_no_args.description.
|
109
|
+
expect(yield_with_no_args.description).to eq("yield with no args")
|
110
110
|
end
|
111
111
|
|
112
112
|
describe "expect {...}.to yield_with_no_args" do
|
@@ -183,9 +183,9 @@ describe "yield_with_args matcher" do
|
|
183
183
|
end
|
184
184
|
|
185
185
|
it 'has a description' do
|
186
|
-
yield_with_args.description.
|
187
|
-
yield_with_args(1, 3).description.
|
188
|
-
yield_with_args(false).description.
|
186
|
+
expect(yield_with_args.description).to eq("yield with args")
|
187
|
+
expect(yield_with_args(1, 3).description).to eq("yield with args(1, 3)")
|
188
|
+
expect(yield_with_args(false).description).to eq("yield with args(false)")
|
189
189
|
end
|
190
190
|
|
191
191
|
describe "expect {...}.to yield_with_args" do
|
@@ -348,8 +348,8 @@ describe "yield_successive_args matcher" do
|
|
348
348
|
end
|
349
349
|
|
350
350
|
it 'has a description' do
|
351
|
-
yield_successive_args(1, 3).description.
|
352
|
-
yield_successive_args([:a, 1], [:b, 2]).description.
|
351
|
+
expect(yield_successive_args(1, 3).description).to eq("yield successive args(1, 3)")
|
352
|
+
expect(yield_successive_args([:a, 1], [:b, 2]).description).to eq("yield successive args([:a, 1], [:b, 2])")
|
353
353
|
end
|
354
354
|
|
355
355
|
describe "expect {...}.to yield_successive_args([:a, 1], [:b, 2])" do
|
data/spec/spec_helper.rb
CHANGED
@@ -1,27 +1,54 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
1
|
+
Dir['./spec/support/**/*'].each {|f| require f}
|
2
|
+
|
3
|
+
RSpec::configure do |config|
|
4
|
+
config.treat_symbols_as_metadata_keys_with_true_values = true
|
5
|
+
config.color_enabled = true
|
6
|
+
config.filter_run :focused
|
7
|
+
config.run_all_when_everything_filtered = true
|
8
|
+
config.order = :random
|
9
|
+
|
10
|
+
config.expect_with :rspec do |expectations|
|
11
|
+
$default_expectation_syntax = expectations.syntax
|
12
|
+
expectations.syntax = :expect
|
7
13
|
end
|
8
14
|
end
|
9
15
|
|
10
|
-
|
16
|
+
shared_context "with #should enabled", :uses_should do
|
17
|
+
orig_syntax = nil
|
11
18
|
|
12
|
-
|
13
|
-
|
14
|
-
|
19
|
+
before(:all) do
|
20
|
+
orig_syntax = RSpec::Matchers.configuration.syntax
|
21
|
+
RSpec::Matchers.configuration.syntax = [:expect, :should]
|
22
|
+
end
|
15
23
|
|
16
|
-
|
17
|
-
|
18
|
-
|
24
|
+
after(:all) do
|
25
|
+
RSpec::Matchers.configuration.syntax = orig_syntax
|
26
|
+
end
|
27
|
+
end
|
19
28
|
|
20
|
-
Dir['./spec/support/**/*'].each {|f| require f}
|
21
29
|
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
30
|
+
shared_context "with #should exclusively enabled", :uses_only_should do
|
31
|
+
orig_syntax = nil
|
32
|
+
|
33
|
+
before(:all) do
|
34
|
+
orig_syntax = RSpec::Matchers.configuration.syntax
|
35
|
+
RSpec::Matchers.configuration.syntax = :should
|
36
|
+
end
|
37
|
+
|
38
|
+
after(:all) do
|
39
|
+
RSpec::Matchers.configuration.syntax = orig_syntax
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
module TestUnitIntegrationSupport
|
44
|
+
include InSubProcess
|
45
|
+
|
46
|
+
def with_test_unit_loaded
|
47
|
+
in_sub_process do
|
48
|
+
require 'test/unit'
|
49
|
+
load 'rspec/matchers.rb'
|
50
|
+
yield
|
51
|
+
end
|
52
|
+
end
|
27
53
|
end
|
54
|
+
|