rspec-expectations 3.0.0.beta1 → 3.0.0.beta2
Sign up to get free protection for your applications and to get access to all the features.
- data.tar.gz.sig +2 -2
- data/.yardopts +1 -0
- data/Changelog.md +138 -0
- data/README.md +75 -8
- data/features/README.md +2 -2
- data/features/built_in_matchers/README.md +12 -9
- data/features/built_in_matchers/comparisons.feature +2 -2
- data/features/built_in_matchers/contain_exactly.feature +46 -0
- data/features/built_in_matchers/expect_change.feature +2 -2
- data/features/built_in_matchers/include.feature +0 -48
- data/features/built_in_matchers/output.feature +70 -0
- data/features/composing_matchers.feature +250 -0
- data/features/compound_expectations.feature +45 -0
- data/features/custom_matchers/access_running_example.feature +1 -1
- data/features/custom_matchers/define_matcher.feature +6 -6
- data/features/custom_matchers/define_matcher_outside_rspec.feature +4 -8
- data/features/test_frameworks/{test_unit.feature → minitest.feature} +11 -11
- data/lib/rspec/expectations.rb +31 -42
- data/lib/rspec/expectations/diff_presenter.rb +141 -0
- data/lib/rspec/expectations/differ.rb +22 -132
- data/lib/rspec/expectations/encoded_string.rb +56 -0
- data/lib/rspec/expectations/expectation_target.rb +0 -30
- data/lib/rspec/expectations/fail_with.rb +2 -2
- data/lib/rspec/expectations/handler.rb +128 -31
- data/lib/rspec/expectations/minitest_integration.rb +16 -0
- data/lib/rspec/expectations/syntax.rb +4 -58
- data/lib/rspec/expectations/version.rb +1 -1
- data/lib/rspec/matchers.rb +298 -60
- data/lib/rspec/matchers/aliased_matcher.rb +35 -0
- data/lib/rspec/matchers/built_in.rb +37 -33
- data/lib/rspec/matchers/built_in/base_matcher.rb +25 -15
- data/lib/rspec/matchers/built_in/be.rb +23 -31
- data/lib/rspec/matchers/built_in/be_between.rb +55 -0
- data/lib/rspec/matchers/built_in/be_within.rb +15 -11
- data/lib/rspec/matchers/built_in/change.rb +198 -81
- data/lib/rspec/matchers/built_in/compound.rb +106 -0
- data/lib/rspec/matchers/built_in/contain_exactly.rb +245 -0
- data/lib/rspec/matchers/built_in/eq.rb +43 -4
- data/lib/rspec/matchers/built_in/eql.rb +2 -2
- data/lib/rspec/matchers/built_in/equal.rb +35 -18
- data/lib/rspec/matchers/built_in/has.rb +16 -15
- data/lib/rspec/matchers/built_in/include.rb +45 -23
- data/lib/rspec/matchers/built_in/match.rb +6 -3
- data/lib/rspec/matchers/built_in/operators.rb +103 -0
- data/lib/rspec/matchers/built_in/output.rb +108 -0
- data/lib/rspec/matchers/built_in/raise_error.rb +9 -15
- data/lib/rspec/matchers/built_in/respond_to.rb +5 -4
- data/lib/rspec/matchers/built_in/satisfy.rb +4 -3
- data/lib/rspec/matchers/built_in/start_and_end_with.rb +37 -16
- data/lib/rspec/matchers/built_in/throw_symbol.rb +6 -5
- data/lib/rspec/matchers/built_in/yield.rb +31 -29
- data/lib/rspec/matchers/composable.rb +138 -0
- data/lib/rspec/matchers/dsl.rb +330 -0
- data/lib/rspec/matchers/generated_descriptions.rb +6 -6
- data/lib/rspec/matchers/matcher_delegator.rb +33 -0
- data/lib/rspec/matchers/pretty.rb +13 -2
- data/spec/rspec/expectations/{differ_spec.rb → diff_presenter_spec.rb} +56 -36
- data/spec/rspec/expectations/encoded_string_spec.rb +74 -0
- data/spec/rspec/expectations/extensions/kernel_spec.rb +11 -11
- data/spec/rspec/expectations/fail_with_spec.rb +8 -8
- data/spec/rspec/expectations/handler_spec.rb +27 -49
- data/spec/rspec/expectations/minitest_integration_spec.rb +27 -0
- data/spec/rspec/expectations/syntax_spec.rb +17 -67
- data/spec/rspec/expectations_spec.rb +7 -52
- data/spec/rspec/matchers/aliased_matcher_spec.rb +48 -0
- data/spec/rspec/matchers/aliases_spec.rb +449 -0
- data/spec/rspec/matchers/{base_matcher_spec.rb → built_in/base_matcher_spec.rb} +24 -3
- data/spec/rspec/matchers/built_in/be_between_spec.rb +159 -0
- data/spec/rspec/matchers/{be_instance_of_spec.rb → built_in/be_instance_of_spec.rb} +0 -0
- data/spec/rspec/matchers/{be_kind_of_spec.rb → built_in/be_kind_of_spec.rb} +0 -0
- data/spec/rspec/matchers/{be_spec.rb → built_in/be_spec.rb} +76 -32
- data/spec/rspec/matchers/{be_within_spec.rb → built_in/be_within_spec.rb} +6 -2
- data/spec/rspec/matchers/{change_spec.rb → built_in/change_spec.rb} +310 -69
- data/spec/rspec/matchers/built_in/compound_spec.rb +292 -0
- data/spec/rspec/matchers/built_in/contain_exactly_spec.rb +441 -0
- data/spec/rspec/matchers/{cover_spec.rb → built_in/cover_spec.rb} +0 -0
- data/spec/rspec/matchers/built_in/eq_spec.rb +156 -0
- data/spec/rspec/matchers/{eql_spec.rb → built_in/eql_spec.rb} +2 -2
- data/spec/rspec/matchers/built_in/equal_spec.rb +106 -0
- data/spec/rspec/matchers/{exist_spec.rb → built_in/exist_spec.rb} +1 -1
- data/spec/rspec/matchers/{has_spec.rb → built_in/has_spec.rb} +39 -0
- data/spec/rspec/matchers/{include_spec.rb → built_in/include_spec.rb} +118 -109
- data/spec/rspec/matchers/{match_spec.rb → built_in/match_spec.rb} +30 -2
- data/spec/rspec/matchers/{operator_matcher_spec.rb → built_in/operators_spec.rb} +26 -26
- data/spec/rspec/matchers/built_in/output_spec.rb +165 -0
- data/spec/rspec/matchers/{raise_error_spec.rb → built_in/raise_error_spec.rb} +81 -11
- data/spec/rspec/matchers/{respond_to_spec.rb → built_in/respond_to_spec.rb} +0 -0
- data/spec/rspec/matchers/{satisfy_spec.rb → built_in/satisfy_spec.rb} +0 -0
- data/spec/rspec/matchers/{start_with_end_with_spec.rb → built_in/start_and_end_with_spec.rb} +82 -15
- data/spec/rspec/matchers/{throw_symbol_spec.rb → built_in/throw_symbol_spec.rb} +29 -10
- data/spec/rspec/matchers/{yield_spec.rb → built_in/yield_spec.rb} +90 -0
- data/spec/rspec/matchers/configuration_spec.rb +7 -39
- data/spec/rspec/matchers/description_generation_spec.rb +22 -6
- data/spec/rspec/matchers/dsl_spec.rb +838 -0
- data/spec/rspec/matchers/legacy_spec.rb +101 -0
- data/spec/rspec/matchers_spec.rb +74 -0
- data/spec/spec_helper.rb +35 -21
- data/spec/support/shared_examples.rb +26 -4
- metadata +172 -116
- metadata.gz.sig +3 -4
- checksums.yaml +0 -15
- checksums.yaml.gz.sig +0 -0
- data/features/built_in_matchers/match_array.feature +0 -37
- data/lib/rspec/expectations/errors.rb +0 -9
- data/lib/rspec/expectations/extensions.rb +0 -1
- data/lib/rspec/expectations/extensions/object.rb +0 -29
- data/lib/rspec/matchers/built_in/match_array.rb +0 -51
- data/lib/rspec/matchers/compatibility.rb +0 -14
- data/lib/rspec/matchers/matcher.rb +0 -301
- data/lib/rspec/matchers/method_missing.rb +0 -12
- data/lib/rspec/matchers/operator_matcher.rb +0 -99
- data/lib/rspec/matchers/test_unit_integration.rb +0 -11
- data/spec/rspec/matchers/eq_spec.rb +0 -60
- data/spec/rspec/matchers/equal_spec.rb +0 -78
- data/spec/rspec/matchers/include_matcher_integration_spec.rb +0 -30
- data/spec/rspec/matchers/match_array_spec.rb +0 -194
- data/spec/rspec/matchers/matcher_spec.rb +0 -706
- data/spec/rspec/matchers/matchers_spec.rb +0 -36
- data/spec/rspec/matchers/method_missing_spec.rb +0 -28
- data/spec/support/classes.rb +0 -56
- data/spec/support/in_sub_process.rb +0 -37
- data/spec/support/ruby_version.rb +0 -10
@@ -1,57 +1,12 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
1
3
|
module RSpec
|
2
4
|
describe Expectations do
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
File.read(file)
|
8
|
-
end
|
9
|
-
|
10
|
-
describe '.method_handle_for(object, method_name)' do
|
11
|
-
|
12
|
-
class UntamperedClass
|
13
|
-
def foo
|
14
|
-
:bar
|
15
|
-
end
|
16
|
-
end
|
17
|
-
|
18
|
-
class ClassWithMethodOverridden < UntamperedClass
|
19
|
-
def method
|
20
|
-
:baz
|
21
|
-
end
|
22
|
-
end
|
23
|
-
|
24
|
-
if RUBY_VERSION.to_f > 1.8
|
25
|
-
class BasicClass < BasicObject
|
26
|
-
def foo
|
27
|
-
:bar
|
28
|
-
end
|
29
|
-
end
|
30
|
-
|
31
|
-
class BasicClassWithKernel < BasicClass
|
32
|
-
include ::Kernel
|
33
|
-
end
|
34
|
-
end
|
35
|
-
|
36
|
-
it 'fetches method definitions for vanilla objects' do
|
37
|
-
object = UntamperedClass.new
|
38
|
-
expect(Expectations.method_handle_for(object, :foo).call).to eq :bar
|
39
|
-
end
|
40
|
-
|
41
|
-
it 'fetches method definitions for objects with method redefined' do
|
42
|
-
object = ClassWithMethodOverridden.new
|
43
|
-
expect(Expectations.method_handle_for(object, :foo).call).to eq :bar
|
44
|
-
end
|
45
|
-
|
46
|
-
it 'fetches method definitions for basic objects', :if => RUBY_VERSION.to_i >= 2 do
|
47
|
-
object = BasicClass.new
|
48
|
-
expect(Expectations.method_handle_for(object, :foo).call).to eq :bar
|
49
|
-
end
|
50
|
-
|
51
|
-
it 'fetches method definitions for basic objects with kernel mixed in', :if => RUBY_VERSION.to_f > 1.8 do
|
52
|
-
object = BasicClassWithKernel.new
|
53
|
-
expect(Expectations.method_handle_for(object, :foo).call).to eq :bar
|
54
|
-
end
|
5
|
+
it 'does not allow expectation failures to be caught by a bare rescue' do
|
6
|
+
expect {
|
7
|
+
expect(2).to eq(3) rescue nil
|
8
|
+
}.to fail_matching("expected: 3")
|
55
9
|
end
|
56
10
|
end
|
57
11
|
end
|
12
|
+
|
@@ -0,0 +1,48 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
module RSpec
|
4
|
+
module Matchers
|
5
|
+
describe AliasedMatcher do
|
6
|
+
RSpec::Matchers.define :my_base_matcher do
|
7
|
+
def foo
|
8
|
+
13
|
9
|
+
end
|
10
|
+
|
11
|
+
def description
|
12
|
+
"my base matcher description"
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
it 'can get a method object for delegated methods', :if => (RUBY_VERSION.to_f > 1.8) do
|
17
|
+
matcher = my_base_matcher
|
18
|
+
decorated = AliasedMatcher.new(matcher, Proc.new { })
|
19
|
+
|
20
|
+
expect(decorated.method(:foo).call).to eq(13)
|
21
|
+
end
|
22
|
+
|
23
|
+
it 'can get a method object for `description`' do
|
24
|
+
matcher = my_base_matcher
|
25
|
+
decorated = AliasedMatcher.new(matcher, Proc.new { "overriden description" })
|
26
|
+
|
27
|
+
expect(decorated.method(:description).call).to eq("overriden description")
|
28
|
+
end
|
29
|
+
|
30
|
+
RSpec::Matchers.alias_matcher :my_overriden_matcher, :my_base_matcher do |desc|
|
31
|
+
desc + " (overriden)"
|
32
|
+
end
|
33
|
+
|
34
|
+
it 'overrides the description with the provided block' do
|
35
|
+
matcher = my_overriden_matcher
|
36
|
+
expect(matcher.description).to eq("my base matcher description (overriden)")
|
37
|
+
end
|
38
|
+
|
39
|
+
RSpec::Matchers.alias_matcher :my_blockless_override, :my_base_matcher
|
40
|
+
|
41
|
+
it 'provides a default description override based on the old and new games' do
|
42
|
+
matcher = my_blockless_override
|
43
|
+
expect(matcher.description).to eq("my blockless override description")
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
@@ -0,0 +1,449 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
module RSpec
|
4
|
+
describe Matchers, "aliases", :order => :defined do
|
5
|
+
matcher :be_aliased_to do |old_matcher|
|
6
|
+
chain :with_description do |desc|
|
7
|
+
@expected_desc = desc
|
8
|
+
end
|
9
|
+
|
10
|
+
match do |aliased_matcher|
|
11
|
+
@actual_desc = aliased_matcher.description
|
12
|
+
|
13
|
+
@actual_desc == @expected_desc &&
|
14
|
+
aliased_matcher.base_matcher.class == old_matcher.class
|
15
|
+
end
|
16
|
+
|
17
|
+
failure_message do |aliased_matcher|
|
18
|
+
"expected #{aliased_matcher} to be aliased to #{old_matcher} with " +
|
19
|
+
"description: #{@expected_desc.inspect}, but got #{@actual_desc.inspect}"
|
20
|
+
end
|
21
|
+
|
22
|
+
description do |aliased_matcher|
|
23
|
+
"have an alias for #{old_matcher.description.inspect} with description: #{@expected_desc.inspect}"
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
specify do
|
28
|
+
expect(a_truthy_value).to be_aliased_to(be_truthy).with_description("a truthy value")
|
29
|
+
end
|
30
|
+
|
31
|
+
specify do
|
32
|
+
expect(a_falsey_value).to be_aliased_to(be_falsey).with_description("a falsey value")
|
33
|
+
end
|
34
|
+
|
35
|
+
specify do
|
36
|
+
expect(be_falsy).to be_aliased_to(be_falsey).with_description("be falsy")
|
37
|
+
end
|
38
|
+
|
39
|
+
specify do
|
40
|
+
expect(a_falsy_value).to be_aliased_to(be_falsey).with_description("a falsy value")
|
41
|
+
end
|
42
|
+
|
43
|
+
specify do
|
44
|
+
expect(a_nil_value).to be_aliased_to(be_nil).with_description("a nil value")
|
45
|
+
end
|
46
|
+
|
47
|
+
specify do
|
48
|
+
expect(a_value > 3).to be_aliased_to(be > 3).with_description("a value > 3")
|
49
|
+
end
|
50
|
+
|
51
|
+
specify do
|
52
|
+
expect(a_value < 3).to be_aliased_to(be < 3).with_description("a value < 3")
|
53
|
+
end
|
54
|
+
|
55
|
+
specify do
|
56
|
+
expect(a_value <= 3).to be_aliased_to(be <= 3).with_description("a value <= 3")
|
57
|
+
end
|
58
|
+
|
59
|
+
specify do
|
60
|
+
expect(a_value == 3).to be_aliased_to(be == 3).with_description("a value == 3")
|
61
|
+
end
|
62
|
+
|
63
|
+
specify do
|
64
|
+
expect(a_value === 3).to be_aliased_to(be === 3).with_description("a value === 3")
|
65
|
+
end
|
66
|
+
|
67
|
+
specify do
|
68
|
+
expect(
|
69
|
+
an_instance_of(Integer)
|
70
|
+
).to be_aliased_to(
|
71
|
+
be_an_instance_of(Integer)
|
72
|
+
).with_description("an instance of Integer")
|
73
|
+
end
|
74
|
+
|
75
|
+
specify do
|
76
|
+
expect(
|
77
|
+
a_kind_of(Integer)
|
78
|
+
).to be_aliased_to(
|
79
|
+
be_a_kind_of(Integer)
|
80
|
+
).with_description("a kind of Integer")
|
81
|
+
end
|
82
|
+
|
83
|
+
specify do
|
84
|
+
expect(
|
85
|
+
a_value_between(1, 10)
|
86
|
+
).to be_aliased_to(
|
87
|
+
be_between(1, 10)
|
88
|
+
).with_description("a value between 1 and 10 (inclusive)")
|
89
|
+
end
|
90
|
+
|
91
|
+
specify do
|
92
|
+
expect(
|
93
|
+
a_value_within(0.1).of(3)
|
94
|
+
).to be_aliased_to(
|
95
|
+
be_within(0.1).of(3)
|
96
|
+
).with_description("a value within 0.1 of 3")
|
97
|
+
end
|
98
|
+
|
99
|
+
specify do
|
100
|
+
expect(
|
101
|
+
within(0.1).of(3)
|
102
|
+
).to be_aliased_to(
|
103
|
+
be_within(0.1).of(3)
|
104
|
+
).with_description("within 0.1 of 3")
|
105
|
+
end
|
106
|
+
|
107
|
+
specify do
|
108
|
+
expect(a_block_changing).to be_aliased_to(change).with_description("a block changing result")
|
109
|
+
end
|
110
|
+
|
111
|
+
specify do
|
112
|
+
expect(changing).to be_aliased_to(change).with_description("changing result")
|
113
|
+
end
|
114
|
+
|
115
|
+
specify do
|
116
|
+
expect(
|
117
|
+
a_collection_containing_exactly(1, 2)
|
118
|
+
).to be_aliased_to(
|
119
|
+
contain_exactly(1, 2)
|
120
|
+
).with_description("a collection containing exactly 1 and 2")
|
121
|
+
end
|
122
|
+
|
123
|
+
specify do
|
124
|
+
expect(
|
125
|
+
containing_exactly(1, 2)
|
126
|
+
).to be_aliased_to(
|
127
|
+
contain_exactly(1, 2)
|
128
|
+
).with_description("containing exactly 1 and 2")
|
129
|
+
end
|
130
|
+
|
131
|
+
specify do
|
132
|
+
expect(
|
133
|
+
a_range_covering(1, 2)
|
134
|
+
).to be_aliased_to(
|
135
|
+
cover(1, 2)
|
136
|
+
).with_description("a range covering 1 and 2")
|
137
|
+
end
|
138
|
+
|
139
|
+
specify do
|
140
|
+
expect(
|
141
|
+
covering(1, 2)
|
142
|
+
).to be_aliased_to(
|
143
|
+
cover(1, 2)
|
144
|
+
).with_description("covering 1 and 2")
|
145
|
+
end
|
146
|
+
|
147
|
+
specify do
|
148
|
+
expect(
|
149
|
+
ending_with(23)
|
150
|
+
).to be_aliased_to(
|
151
|
+
end_with(23)
|
152
|
+
).with_description("ending with 23")
|
153
|
+
end
|
154
|
+
|
155
|
+
specify do
|
156
|
+
expect(
|
157
|
+
a_collection_ending_with(23)
|
158
|
+
).to be_aliased_to(
|
159
|
+
end_with(23)
|
160
|
+
).with_description("a collection ending with 23")
|
161
|
+
end
|
162
|
+
|
163
|
+
specify do
|
164
|
+
expect(
|
165
|
+
a_string_ending_with("z")
|
166
|
+
).to be_aliased_to(
|
167
|
+
end_with("z")
|
168
|
+
).with_description('a string ending with "z"')
|
169
|
+
end
|
170
|
+
|
171
|
+
specify do
|
172
|
+
expect(
|
173
|
+
an_object_eq_to(3)
|
174
|
+
).to be_aliased_to(eq 3).with_description("an object eq to 3")
|
175
|
+
end
|
176
|
+
|
177
|
+
specify do
|
178
|
+
expect(
|
179
|
+
eq_to(3)
|
180
|
+
).to be_aliased_to(eq 3).with_description("eq to 3")
|
181
|
+
end
|
182
|
+
|
183
|
+
specify do
|
184
|
+
expect(
|
185
|
+
an_object_eql_to(3)
|
186
|
+
).to be_aliased_to(eql 3).with_description("an object eql to 3")
|
187
|
+
end
|
188
|
+
|
189
|
+
specify do
|
190
|
+
expect(
|
191
|
+
eql_to(3)
|
192
|
+
).to be_aliased_to(eql 3).with_description("eql to 3")
|
193
|
+
end
|
194
|
+
|
195
|
+
specify do
|
196
|
+
expect(
|
197
|
+
an_object_equal_to(3)
|
198
|
+
).to be_aliased_to(equal 3).with_description("an object equal to 3")
|
199
|
+
end
|
200
|
+
|
201
|
+
specify do
|
202
|
+
expect(
|
203
|
+
equal_to(3)
|
204
|
+
).to be_aliased_to(equal 3).with_description("equal to 3")
|
205
|
+
end
|
206
|
+
|
207
|
+
specify do
|
208
|
+
expect(
|
209
|
+
an_object_existing
|
210
|
+
).to be_aliased_to(exist).with_description("an object existing")
|
211
|
+
end
|
212
|
+
|
213
|
+
specify do
|
214
|
+
expect(existing).to be_aliased_to(exist).with_description("existing")
|
215
|
+
end
|
216
|
+
|
217
|
+
specify do
|
218
|
+
expect(
|
219
|
+
a_string_including("a")
|
220
|
+
).to be_aliased_to(
|
221
|
+
include("a")
|
222
|
+
).with_description('a string including "a"')
|
223
|
+
end
|
224
|
+
|
225
|
+
specify do
|
226
|
+
expect(
|
227
|
+
a_collection_including("a")
|
228
|
+
).to be_aliased_to(
|
229
|
+
include("a")
|
230
|
+
).with_description('a collection including "a"')
|
231
|
+
end
|
232
|
+
|
233
|
+
specify do
|
234
|
+
expect(
|
235
|
+
a_hash_including(:a => 5)
|
236
|
+
).to be_aliased_to(
|
237
|
+
include(:a => 5)
|
238
|
+
).with_description('a hash including {:a => 5}')
|
239
|
+
end
|
240
|
+
|
241
|
+
specify do
|
242
|
+
expect(
|
243
|
+
including(3)
|
244
|
+
).to be_aliased_to(
|
245
|
+
include(3)
|
246
|
+
).with_description('including 3')
|
247
|
+
end
|
248
|
+
|
249
|
+
specify do
|
250
|
+
expect(
|
251
|
+
a_string_matching(/foo/)
|
252
|
+
).to be_aliased_to(
|
253
|
+
match(/foo/)
|
254
|
+
).with_description('a string matching /foo/')
|
255
|
+
end
|
256
|
+
|
257
|
+
specify do
|
258
|
+
expect(
|
259
|
+
an_object_matching(/foo/)
|
260
|
+
).to be_aliased_to(
|
261
|
+
match(/foo/)
|
262
|
+
).with_description('an object matching /foo/')
|
263
|
+
end
|
264
|
+
|
265
|
+
specify do
|
266
|
+
expect(
|
267
|
+
match_regex(/foo/)
|
268
|
+
).to be_aliased_to(
|
269
|
+
match(/foo/)
|
270
|
+
).with_description('match regex /foo/')
|
271
|
+
end
|
272
|
+
|
273
|
+
specify do
|
274
|
+
expect(
|
275
|
+
matching(/foo/)
|
276
|
+
).to be_aliased_to(
|
277
|
+
match(/foo/)
|
278
|
+
).with_description('matching /foo/')
|
279
|
+
end
|
280
|
+
|
281
|
+
specify do
|
282
|
+
expect(
|
283
|
+
a_block_outputting('foo').to_stdout
|
284
|
+
).to be_aliased_to(
|
285
|
+
output('foo').to_stdout
|
286
|
+
).with_description('a block outputting "foo" to stdout')
|
287
|
+
end
|
288
|
+
|
289
|
+
specify do
|
290
|
+
expect(
|
291
|
+
a_block_outputting('foo').to_stderr
|
292
|
+
).to be_aliased_to(
|
293
|
+
output('foo').to_stderr
|
294
|
+
).with_description('a block outputting "foo" to stderr')
|
295
|
+
end
|
296
|
+
|
297
|
+
specify do
|
298
|
+
expect(
|
299
|
+
a_block_raising(ArgumentError)
|
300
|
+
).to be_aliased_to(
|
301
|
+
raise_error(ArgumentError)
|
302
|
+
).with_description('a block raising ArgumentError')
|
303
|
+
end
|
304
|
+
|
305
|
+
specify do
|
306
|
+
expect(
|
307
|
+
raising(ArgumentError)
|
308
|
+
).to be_aliased_to(
|
309
|
+
raise_error(ArgumentError)
|
310
|
+
).with_description("raising ArgumentError")
|
311
|
+
end
|
312
|
+
|
313
|
+
specify do
|
314
|
+
expect(
|
315
|
+
an_object_responding_to(:foo)
|
316
|
+
).to be_aliased_to(
|
317
|
+
respond_to(:foo)
|
318
|
+
).with_description("an object responding to #foo")
|
319
|
+
end
|
320
|
+
|
321
|
+
specify do
|
322
|
+
expect(
|
323
|
+
responding_to(:foo)
|
324
|
+
).to be_aliased_to(
|
325
|
+
respond_to(:foo)
|
326
|
+
).with_description("responding to #foo")
|
327
|
+
end
|
328
|
+
|
329
|
+
specify do
|
330
|
+
expect(
|
331
|
+
an_object_satisfying { }
|
332
|
+
).to be_aliased_to(
|
333
|
+
satisfy { }
|
334
|
+
).with_description("an object satisfying block")
|
335
|
+
end
|
336
|
+
|
337
|
+
specify do
|
338
|
+
expect(
|
339
|
+
satisfying { }
|
340
|
+
).to be_aliased_to(
|
341
|
+
satisfy { }
|
342
|
+
).with_description("satisfying block")
|
343
|
+
end
|
344
|
+
|
345
|
+
specify do
|
346
|
+
expect(
|
347
|
+
a_collection_starting_with(23)
|
348
|
+
).to be_aliased_to(
|
349
|
+
start_with(23)
|
350
|
+
).with_description("a collection starting with 23")
|
351
|
+
end
|
352
|
+
|
353
|
+
specify do
|
354
|
+
expect(
|
355
|
+
a_string_starting_with("z")
|
356
|
+
).to be_aliased_to(
|
357
|
+
start_with("z")
|
358
|
+
).with_description('a string starting with "z"')
|
359
|
+
end
|
360
|
+
|
361
|
+
specify do
|
362
|
+
expect(
|
363
|
+
starting_with("d")
|
364
|
+
).to be_aliased_to(
|
365
|
+
start_with("d")
|
366
|
+
).with_description('starting with "d"')
|
367
|
+
end
|
368
|
+
|
369
|
+
specify do
|
370
|
+
expect(
|
371
|
+
a_block_throwing(:foo)
|
372
|
+
).to be_aliased_to(
|
373
|
+
throw_symbol(:foo)
|
374
|
+
).with_description("a block throwing :foo")
|
375
|
+
end
|
376
|
+
|
377
|
+
specify do
|
378
|
+
expect(
|
379
|
+
throwing(:foo)
|
380
|
+
).to be_aliased_to(
|
381
|
+
throw_symbol(:foo)
|
382
|
+
).with_description("throwing :foo")
|
383
|
+
end
|
384
|
+
|
385
|
+
specify do
|
386
|
+
expect(
|
387
|
+
a_block_yielding_control
|
388
|
+
).to be_aliased_to(
|
389
|
+
yield_control
|
390
|
+
).with_description("a block yielding control")
|
391
|
+
end
|
392
|
+
|
393
|
+
specify do
|
394
|
+
expect(
|
395
|
+
yielding_control
|
396
|
+
).to be_aliased_to(
|
397
|
+
yield_control
|
398
|
+
).with_description("yielding control")
|
399
|
+
end
|
400
|
+
|
401
|
+
specify do
|
402
|
+
expect(
|
403
|
+
a_block_yielding_with_no_args
|
404
|
+
).to be_aliased_to(
|
405
|
+
yield_with_no_args
|
406
|
+
).with_description("a block yielding with no args")
|
407
|
+
end
|
408
|
+
|
409
|
+
specify do
|
410
|
+
expect(
|
411
|
+
yielding_with_no_args
|
412
|
+
).to be_aliased_to(
|
413
|
+
yield_with_no_args
|
414
|
+
).with_description("yielding with no args")
|
415
|
+
end
|
416
|
+
|
417
|
+
specify do
|
418
|
+
expect(
|
419
|
+
a_block_yielding_with_args
|
420
|
+
).to be_aliased_to(
|
421
|
+
yield_with_args
|
422
|
+
).with_description("a block yielding with args")
|
423
|
+
end
|
424
|
+
|
425
|
+
specify do
|
426
|
+
expect(
|
427
|
+
yielding_with_args
|
428
|
+
).to be_aliased_to(
|
429
|
+
yield_with_args
|
430
|
+
).with_description("yielding with args")
|
431
|
+
end
|
432
|
+
|
433
|
+
specify do
|
434
|
+
expect(
|
435
|
+
a_block_yielding_successive_args
|
436
|
+
).to be_aliased_to(
|
437
|
+
yield_successive_args
|
438
|
+
).with_description("a block yielding successive args()")
|
439
|
+
end
|
440
|
+
|
441
|
+
specify do
|
442
|
+
expect(
|
443
|
+
yielding_successive_args
|
444
|
+
).to be_aliased_to(
|
445
|
+
yield_successive_args
|
446
|
+
).with_description("yielding successive args()")
|
447
|
+
end
|
448
|
+
end
|
449
|
+
end
|