rspec-expectations 2.14.0 → 3.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.
Files changed (155) hide show
  1. checksums.yaml +7 -0
  2. checksums.yaml.gz.sig +0 -0
  3. data/.document +1 -1
  4. data/.yardopts +1 -1
  5. data/Changelog.md +976 -25
  6. data/{License.txt → LICENSE.md} +5 -3
  7. data/README.md +162 -26
  8. data/lib/rspec/expectations/block_snippet_extractor.rb +253 -0
  9. data/lib/rspec/expectations/configuration.rb +230 -0
  10. data/lib/rspec/expectations/expectation_target.rb +127 -51
  11. data/lib/rspec/expectations/fail_with.rb +17 -57
  12. data/lib/rspec/expectations/failure_aggregator.rb +229 -0
  13. data/lib/rspec/expectations/handler.rb +146 -32
  14. data/lib/rspec/expectations/minitest_integration.rb +58 -0
  15. data/lib/rspec/expectations/syntax.rb +68 -100
  16. data/lib/rspec/expectations/version.rb +1 -1
  17. data/lib/rspec/expectations.rb +58 -23
  18. data/lib/rspec/matchers/aliased_matcher.rb +116 -0
  19. data/lib/rspec/matchers/built_in/all.rb +86 -0
  20. data/lib/rspec/matchers/built_in/base_matcher.rb +191 -20
  21. data/lib/rspec/matchers/built_in/be.rb +114 -114
  22. data/lib/rspec/matchers/built_in/be_between.rb +77 -0
  23. data/lib/rspec/matchers/built_in/be_instance_of.rb +15 -4
  24. data/lib/rspec/matchers/built_in/be_kind_of.rb +10 -1
  25. data/lib/rspec/matchers/built_in/be_within.rb +35 -18
  26. data/lib/rspec/matchers/built_in/change.rb +389 -80
  27. data/lib/rspec/matchers/built_in/compound.rb +290 -0
  28. data/lib/rspec/matchers/built_in/contain_exactly.rb +310 -0
  29. data/lib/rspec/matchers/built_in/count_expectation.rb +169 -0
  30. data/lib/rspec/matchers/built_in/cover.rb +3 -0
  31. data/lib/rspec/matchers/built_in/eq.rb +30 -8
  32. data/lib/rspec/matchers/built_in/eql.rb +23 -8
  33. data/lib/rspec/matchers/built_in/equal.rb +55 -22
  34. data/lib/rspec/matchers/built_in/exist.rb +74 -10
  35. data/lib/rspec/matchers/built_in/has.rb +141 -22
  36. data/lib/rspec/matchers/built_in/have_attributes.rb +114 -0
  37. data/lib/rspec/matchers/built_in/include.rb +184 -32
  38. data/lib/rspec/matchers/built_in/match.rb +95 -1
  39. data/lib/rspec/matchers/built_in/operators.rb +128 -0
  40. data/lib/rspec/matchers/built_in/output.rb +207 -0
  41. data/lib/rspec/matchers/built_in/raise_error.rb +192 -44
  42. data/lib/rspec/matchers/built_in/respond_to.rb +154 -28
  43. data/lib/rspec/matchers/built_in/satisfy.rb +39 -9
  44. data/lib/rspec/matchers/built_in/start_or_end_with.rb +94 -0
  45. data/lib/rspec/matchers/built_in/throw_symbol.rb +58 -14
  46. data/lib/rspec/matchers/built_in/yield.rb +240 -161
  47. data/lib/rspec/matchers/built_in.rb +47 -33
  48. data/lib/rspec/matchers/composable.rb +171 -0
  49. data/lib/rspec/matchers/dsl.rb +531 -10
  50. data/lib/rspec/matchers/english_phrasing.rb +58 -0
  51. data/lib/rspec/matchers/fail_matchers.rb +42 -0
  52. data/lib/rspec/matchers/generated_descriptions.rb +14 -8
  53. data/lib/rspec/matchers/matcher_delegator.rb +61 -0
  54. data/lib/rspec/matchers/matcher_protocol.rb +105 -0
  55. data/lib/rspec/matchers/multi_matcher_diff.rb +82 -0
  56. data/lib/rspec/matchers.rb +520 -173
  57. data.tar.gz.sig +0 -0
  58. metadata +141 -242
  59. metadata.gz.sig +2 -0
  60. data/features/README.md +0 -48
  61. data/features/Upgrade.md +0 -53
  62. data/features/built_in_matchers/README.md +0 -90
  63. data/features/built_in_matchers/be.feature +0 -175
  64. data/features/built_in_matchers/be_within.feature +0 -48
  65. data/features/built_in_matchers/cover.feature +0 -47
  66. data/features/built_in_matchers/end_with.feature +0 -48
  67. data/features/built_in_matchers/equality.feature +0 -139
  68. data/features/built_in_matchers/exist.feature +0 -45
  69. data/features/built_in_matchers/expect_change.feature +0 -59
  70. data/features/built_in_matchers/expect_error.feature +0 -144
  71. data/features/built_in_matchers/have.feature +0 -109
  72. data/features/built_in_matchers/include.feature +0 -174
  73. data/features/built_in_matchers/match.feature +0 -52
  74. data/features/built_in_matchers/operators.feature +0 -227
  75. data/features/built_in_matchers/predicates.feature +0 -137
  76. data/features/built_in_matchers/respond_to.feature +0 -84
  77. data/features/built_in_matchers/satisfy.feature +0 -33
  78. data/features/built_in_matchers/start_with.feature +0 -48
  79. data/features/built_in_matchers/throw_symbol.feature +0 -91
  80. data/features/built_in_matchers/types.feature +0 -116
  81. data/features/built_in_matchers/yield.feature +0 -161
  82. data/features/custom_matchers/access_running_example.feature +0 -53
  83. data/features/custom_matchers/define_diffable_matcher.feature +0 -27
  84. data/features/custom_matchers/define_matcher.feature +0 -368
  85. data/features/custom_matchers/define_matcher_outside_rspec.feature +0 -38
  86. data/features/custom_matchers/define_matcher_with_fluent_interface.feature +0 -24
  87. data/features/customized_message.feature +0 -22
  88. data/features/diffing.feature +0 -85
  89. data/features/implicit_docstrings.feature +0 -52
  90. data/features/step_definitions/additional_cli_steps.rb +0 -22
  91. data/features/support/env.rb +0 -14
  92. data/features/syntax_configuration.feature +0 -71
  93. data/features/test_frameworks/test_unit.feature +0 -44
  94. data/lib/rspec/expectations/deprecation.rb +0 -17
  95. data/lib/rspec/expectations/differ.rb +0 -133
  96. data/lib/rspec/expectations/errors.rb +0 -9
  97. data/lib/rspec/expectations/extensions/array.rb +0 -9
  98. data/lib/rspec/expectations/extensions/object.rb +0 -29
  99. data/lib/rspec/expectations/extensions.rb +0 -2
  100. data/lib/rspec/matchers/be_close.rb +0 -9
  101. data/lib/rspec/matchers/built_in/have.rb +0 -124
  102. data/lib/rspec/matchers/built_in/match_array.rb +0 -51
  103. data/lib/rspec/matchers/built_in/start_and_end_with.rb +0 -48
  104. data/lib/rspec/matchers/compatibility.rb +0 -14
  105. data/lib/rspec/matchers/configuration.rb +0 -108
  106. data/lib/rspec/matchers/extensions/instance_eval_with_args.rb +0 -39
  107. data/lib/rspec/matchers/matcher.rb +0 -300
  108. data/lib/rspec/matchers/method_missing.rb +0 -12
  109. data/lib/rspec/matchers/operator_matcher.rb +0 -109
  110. data/lib/rspec/matchers/pretty.rb +0 -70
  111. data/lib/rspec/matchers/test_unit_integration.rb +0 -11
  112. data/lib/rspec-expectations.rb +0 -1
  113. data/spec/rspec/expectations/differ_spec.rb +0 -192
  114. data/spec/rspec/expectations/expectation_target_spec.rb +0 -82
  115. data/spec/rspec/expectations/extensions/kernel_spec.rb +0 -67
  116. data/spec/rspec/expectations/fail_with_spec.rb +0 -114
  117. data/spec/rspec/expectations/handler_spec.rb +0 -227
  118. data/spec/rspec/expectations/syntax_spec.rb +0 -139
  119. data/spec/rspec/matchers/base_matcher_spec.rb +0 -62
  120. data/spec/rspec/matchers/be_close_spec.rb +0 -22
  121. data/spec/rspec/matchers/be_instance_of_spec.rb +0 -63
  122. data/spec/rspec/matchers/be_kind_of_spec.rb +0 -41
  123. data/spec/rspec/matchers/be_spec.rb +0 -516
  124. data/spec/rspec/matchers/be_within_spec.rb +0 -137
  125. data/spec/rspec/matchers/change_spec.rb +0 -553
  126. data/spec/rspec/matchers/configuration_spec.rb +0 -206
  127. data/spec/rspec/matchers/cover_spec.rb +0 -69
  128. data/spec/rspec/matchers/description_generation_spec.rb +0 -190
  129. data/spec/rspec/matchers/dsl_spec.rb +0 -57
  130. data/spec/rspec/matchers/eq_spec.rb +0 -60
  131. data/spec/rspec/matchers/eql_spec.rb +0 -41
  132. data/spec/rspec/matchers/equal_spec.rb +0 -78
  133. data/spec/rspec/matchers/exist_spec.rb +0 -124
  134. data/spec/rspec/matchers/has_spec.rb +0 -122
  135. data/spec/rspec/matchers/have_spec.rb +0 -455
  136. data/spec/rspec/matchers/include_matcher_integration_spec.rb +0 -30
  137. data/spec/rspec/matchers/include_spec.rb +0 -531
  138. data/spec/rspec/matchers/match_array_spec.rb +0 -194
  139. data/spec/rspec/matchers/match_spec.rb +0 -61
  140. data/spec/rspec/matchers/matcher_spec.rb +0 -471
  141. data/spec/rspec/matchers/matchers_spec.rb +0 -37
  142. data/spec/rspec/matchers/method_missing_spec.rb +0 -28
  143. data/spec/rspec/matchers/operator_matcher_spec.rb +0 -223
  144. data/spec/rspec/matchers/raise_error_spec.rb +0 -485
  145. data/spec/rspec/matchers/respond_to_spec.rb +0 -292
  146. data/spec/rspec/matchers/satisfy_spec.rb +0 -44
  147. data/spec/rspec/matchers/start_with_end_with_spec.rb +0 -186
  148. data/spec/rspec/matchers/throw_symbol_spec.rb +0 -116
  149. data/spec/rspec/matchers/yield_spec.rb +0 -514
  150. data/spec/spec_helper.rb +0 -54
  151. data/spec/support/classes.rb +0 -56
  152. data/spec/support/in_sub_process.rb +0 -38
  153. data/spec/support/matchers.rb +0 -22
  154. data/spec/support/ruby_version.rb +0 -10
  155. data/spec/support/shared_examples.rb +0 -13
@@ -1,116 +0,0 @@
1
- Feature: specify types of objects
2
-
3
- rspec-expectations includes two matchers to specify types of objects:
4
-
5
- * `obj.should be_kind_of(type)`: calls `obj.kind_of?(type)`, which returns
6
- true if type is in obj's class hierarchy or is a module and is
7
- included in a class in obj's class hierarchy.
8
- * `obj.should be_instance_of(type)`: calls `obj.instance_of?(type)`, which
9
- returns true if and only if type if obj's class.
10
-
11
- Both of these matchers have aliases:
12
-
13
- ```ruby
14
- obj.should be_a_kind_of(type) # same as obj.should be_kind_of(type)
15
- obj.should be_a(type) # same as obj.should be_kind_of(type)
16
- obj.should be_an(type) # same as obj.should be_kind_of(type)
17
- obj.should be_an_instance_of(type) # same as obj.should be_instance_of(type)
18
- ```
19
-
20
- Scenario: be_(a_)kind_of matcher
21
- Given a file named "be_kind_of_matcher_spec.rb" with:
22
- """ruby
23
- module MyModule; end
24
-
25
- class Fixnum
26
- include MyModule
27
- end
28
-
29
- describe 17 do
30
- # the actual class
31
- it { should be_kind_of(Fixnum) }
32
- it { should be_a_kind_of(Fixnum) }
33
- it { should be_a(Fixnum) }
34
-
35
- # the superclass
36
- it { should be_kind_of(Integer) }
37
- it { should be_a_kind_of(Integer) }
38
- it { should be_an(Integer) }
39
-
40
- # an included module
41
- it { should be_kind_of(MyModule) }
42
- it { should be_a_kind_of(MyModule) }
43
- it { should be_a(MyModule) }
44
-
45
- # negative passing case
46
- it { should_not be_kind_of(String) }
47
- it { should_not be_a_kind_of(String) }
48
- it { should_not be_a(String) }
49
-
50
- # deliberate failures
51
- it { should_not be_kind_of(Fixnum) }
52
- it { should_not be_a_kind_of(Fixnum) }
53
- it { should_not be_a(Fixnum) }
54
- it { should_not be_kind_of(Integer) }
55
- it { should_not be_a_kind_of(Integer) }
56
- it { should_not be_an(Integer) }
57
- it { should_not be_kind_of(MyModule) }
58
- it { should_not be_a_kind_of(MyModule) }
59
- it { should_not be_a(MyModule) }
60
- it { should be_kind_of(String) }
61
- it { should be_a_kind_of(String) }
62
- it { should be_a(String) }
63
- end
64
- """
65
- When I run `rspec be_kind_of_matcher_spec.rb`
66
- Then the output should contain all of these:
67
- | 24 examples, 12 failures |
68
- | expected 17 not to be a kind of Fixnum |
69
- | expected 17 not to be a kind of Integer |
70
- | expected 17 not to be a kind of MyModule |
71
- | expected 17 to be a kind of String |
72
-
73
- Scenario: be_(an_)instance_of matcher
74
- Given a file named "be_instance_of_matcher_spec.rb" with:
75
- """ruby
76
- module MyModule; end
77
-
78
- class Fixnum
79
- include MyModule
80
- end
81
-
82
- describe 17 do
83
- # the actual class
84
- it { should be_instance_of(Fixnum) }
85
- it { should be_an_instance_of(Fixnum) }
86
-
87
- # the superclass
88
- it { should_not be_instance_of(Integer) }
89
- it { should_not be_an_instance_of(Integer) }
90
-
91
- # an included module
92
- it { should_not be_instance_of(MyModule) }
93
- it { should_not be_an_instance_of(MyModule) }
94
-
95
- # another class with no relation to the subject's hierarchy
96
- it { should_not be_instance_of(String) }
97
- it { should_not be_an_instance_of(String) }
98
-
99
- # deliberate failures
100
- it { should_not be_instance_of(Fixnum) }
101
- it { should_not be_an_instance_of(Fixnum) }
102
- it { should be_instance_of(Integer) }
103
- it { should be_an_instance_of(Integer) }
104
- it { should be_instance_of(MyModule) }
105
- it { should be_an_instance_of(MyModule) }
106
- it { should be_instance_of(String) }
107
- it { should be_an_instance_of(String) }
108
- end
109
- """
110
- When I run `rspec be_instance_of_matcher_spec.rb`
111
- Then the output should contain all of these:
112
- | 16 examples, 8 failures |
113
- | expected 17 not to be an instance of Fixnum |
114
- | expected 17 to be an instance of Integer |
115
- | expected 17 to be an instance of MyModule |
116
- | expected 17 to be an instance of String |
@@ -1,161 +0,0 @@
1
- Feature: yield matchers
2
-
3
- There are four related matchers that allow you to specify whether
4
- or not a method yields, how many times it yields, whether or not
5
- it yields with arguments, and what those arguments are.
6
-
7
- * `yield_control` matches if the method-under-test yields, regardless
8
- of whether or not arguments are yielded.
9
- * `yield_with_args` matches if the method-under-test yields with
10
- arguments. If arguments are provided to this matcher, it will
11
- only pass if the actual yielded arguments match the expected ones
12
- using `===` or `==`.
13
- * `yield_with_no_args` matches if the method-under-test yields with
14
- no arguments.
15
- * `yield_successive_args` is designed for iterators, and will match
16
- if the method-under-test yields the same number of times as arguments
17
- passed to this matcher, and all actual yielded arguments match the
18
- expected ones using `===` or `==`.
19
-
20
- Note: your expect block _must_ accept an argument that is then passed on to
21
- the method-under-test as a block. This acts as a "probe" that allows the matcher
22
- to detect whether or not your method yields, and, if so, how many times and what
23
- the yielded arguments are.
24
-
25
- Background:
26
- Given a file named "my_class.rb" with:
27
- """ruby
28
- class MyClass
29
- def self.yield_once_with(*args)
30
- yield *args
31
- end
32
-
33
- def self.yield_twice_with(*args)
34
- 2.times { yield *args }
35
- end
36
-
37
- def self.raw_yield
38
- yield
39
- end
40
-
41
- def self.dont_yield
42
- end
43
- end
44
- """
45
-
46
- Scenario: yield_control matcher
47
- Given a file named "yield_control_spec.rb" with:
48
- """ruby
49
- require './my_class'
50
-
51
- describe "yield_control matcher" do
52
- specify { expect { |b| MyClass.yield_once_with(1, &b) }.to yield_control }
53
- specify { expect { |b| MyClass.dont_yield(&b) }.not_to yield_control }
54
- specify { expect { |b| MyClass.yield_twice_with(1, &b) }.to yield_control.twice }
55
- specify { expect { |b| MyClass.yield_twice_with(1, &b) }.to yield_control.exactly(2).times }
56
- specify { expect { |b| MyClass.yield_twice_with(1, &b) }.to yield_control.at_least(1) }
57
- specify { expect { |b| MyClass.yield_twice_with(1, &b) }.to yield_control.at_most(3).times }
58
-
59
- # deliberate failures
60
- specify { expect { |b| MyClass.yield_once_with(1, &b) }.not_to yield_control }
61
- specify { expect { |b| MyClass.dont_yield(&b) }.to yield_control }
62
- specify { expect { |b| MyClass.yield_once_with(1, &b) }.to yield_control.at_least(2).times }
63
- specify { expect { |b| MyClass.yield_twice_with(1, &b) }.not_to yield_control.twice }
64
- specify { expect { |b| MyClass.yield_twice_with(1, &b) }.not_to yield_control.at_least(2).times }
65
- specify { expect { |b| MyClass.yield_twice_with(1, &b) }.not_to yield_control.at_least(1) }
66
- specify { expect { |b| MyClass.yield_twice_with(1, &b) }.not_to yield_control.at_most(3).times }
67
- end
68
- """
69
- When I run `rspec yield_control_spec.rb`
70
- Then the output should contain all of these:
71
- | 13 examples, 7 failures |
72
- | expected given block to yield control |
73
- | expected given block not to yield control |
74
- | expected given block not to yield control at least twice |
75
- | expected given block not to yield control at most 3 times |
76
-
77
- Scenario: yield_with_args matcher
78
- Given a file named "yield_with_args_spec.rb" with:
79
- """ruby
80
- require './my_class'
81
-
82
- describe "yield_with_args matcher" do
83
- specify { expect { |b| MyClass.yield_once_with("foo", &b) }.to yield_with_args }
84
- specify { expect { |b| MyClass.yield_once_with("foo", &b) }.to yield_with_args("foo") }
85
- specify { expect { |b| MyClass.yield_once_with("foo", &b) }.to yield_with_args(String) }
86
- specify { expect { |b| MyClass.yield_once_with("foo", &b) }.to yield_with_args(/oo/) }
87
-
88
- specify { expect { |b| MyClass.yield_once_with("foo", "bar", &b) }.to yield_with_args("foo", "bar") }
89
- specify { expect { |b| MyClass.yield_once_with("foo", "bar", &b) }.to yield_with_args(String, String) }
90
- specify { expect { |b| MyClass.yield_once_with("foo", "bar", &b) }.to yield_with_args(/fo/, /ar/) }
91
-
92
- specify { expect { |b| MyClass.yield_once_with("foo", "bar", &b) }.not_to yield_with_args(17, "baz") }
93
-
94
- # deliberate failures
95
- specify { expect { |b| MyClass.yield_once_with("foo", &b) }.not_to yield_with_args }
96
- specify { expect { |b| MyClass.yield_once_with("foo", &b) }.not_to yield_with_args("foo") }
97
- specify { expect { |b| MyClass.yield_once_with("foo", &b) }.not_to yield_with_args(String) }
98
- specify { expect { |b| MyClass.yield_once_with("foo", &b) }.not_to yield_with_args(/oo/) }
99
- specify { expect { |b| MyClass.yield_once_with("foo", "bar", &b) }.not_to yield_with_args("foo", "bar") }
100
- specify { expect { |b| MyClass.yield_once_with("foo", "bar", &b) }.to yield_with_args(17, "baz") }
101
- end
102
- """
103
- When I run `rspec yield_with_args_spec.rb`
104
- Then the output should contain all of these:
105
- | 14 examples, 6 failures |
106
- | expected given block not to yield with arguments, but did |
107
- | expected given block not to yield with arguments, but yielded with expected arguments |
108
- | expected given block to yield with arguments, but yielded with unexpected arguments |
109
-
110
- Scenario: yield_with_no_args matcher
111
- Given a file named "yield_with_no_args_spec.rb" with:
112
- """ruby
113
- require './my_class'
114
-
115
- describe "yield_with_no_args matcher" do
116
- specify { expect { |b| MyClass.raw_yield(&b) }.to yield_with_no_args }
117
- specify { expect { |b| MyClass.dont_yield(&b) }.not_to yield_with_no_args }
118
- specify { expect { |b| MyClass.yield_once_with("a", &b) }.not_to yield_with_no_args }
119
-
120
- # deliberate failures
121
- specify { expect { |b| MyClass.raw_yield(&b) }.not_to yield_with_no_args }
122
- specify { expect { |b| MyClass.dont_yield(&b) }.to yield_with_no_args }
123
- specify { expect { |b| MyClass.yield_once_with("a", &b) }.to yield_with_no_args }
124
- end
125
- """
126
- When I run `rspec yield_with_no_args_spec.rb`
127
- Then the output should contain all of these:
128
- | 6 examples, 3 failures |
129
- | expected given block not to yield with no arguments, but did |
130
- | expected given block to yield with no arguments, but did not yield |
131
- | expected given block to yield with no arguments, but yielded with arguments: ["a"] |
132
-
133
- Scenario: yield_successive_args matcher
134
- Given a file named "yield_successive_args_spec.rb" with:
135
- """ruby
136
- def array
137
- [1, 2, 3]
138
- end
139
-
140
- def array_of_tuples
141
- [[:a, :b], [:c, :d]]
142
- end
143
-
144
- describe "yield_successive_args matcher" do
145
- specify { expect { |b| array.each(&b) }.to yield_successive_args(1, 2, 3) }
146
- specify { expect { |b| array_of_tuples.each(&b) }.to yield_successive_args([:a, :b], [:c, :d]) }
147
- specify { expect { |b| array.each(&b) }.to yield_successive_args(Fixnum, Fixnum, Fixnum) }
148
- specify { expect { |b| array.each(&b) }.not_to yield_successive_args(1, 2) }
149
-
150
- # deliberate failures
151
- specify { expect { |b| array.each(&b) }.not_to yield_successive_args(1, 2, 3) }
152
- specify { expect { |b| array_of_tuples.each(&b) }.not_to yield_successive_args([:a, :b], [:c, :d]) }
153
- specify { expect { |b| array.each(&b) }.not_to yield_successive_args(Fixnum, Fixnum, Fixnum) }
154
- specify { expect { |b| array.each(&b) }.to yield_successive_args(1, 2) }
155
- end
156
- """
157
- When I run `rspec yield_successive_args_spec.rb`
158
- Then the output should contain all of these:
159
- | 8 examples, 4 failures |
160
- | expected given block not to yield successively with arguments, but yielded with expected arguments |
161
- | expected given block to yield successively with arguments, but yielded with unexpected arguments |
@@ -1,53 +0,0 @@
1
- Feature: access running example
2
-
3
- In order to take advantage of services that are available
4
- in my examples when I'm writing matchers
5
- As a spec author
6
- I want to call methods on the running example
7
-
8
- If the method exists in the context of the example, it gets
9
- called. If not, a NoMethodError is raised on the Matcher itself
10
- (not the example).
11
-
12
- Scenario: call method defined on example from matcher
13
- Given a file named "example_spec.rb" with:
14
- """ruby
15
- RSpec::Matchers.define :bar do
16
- match do |_|
17
- foo == "foo"
18
- end
19
- end
20
-
21
- describe "something" do
22
- def foo
23
- "foo"
24
- end
25
-
26
- it "does something" do
27
- "foo".should bar
28
- end
29
- end
30
- """
31
- When I run `rspec ./example_spec.rb`
32
- Then the output should contain "1 example, 0 failures"
33
-
34
- Scenario: call method _not_ defined on example from matcher
35
- Given a file named "example_spec.rb" with:
36
- """ruby
37
- RSpec::Matchers.define :bar do
38
- match do |_|
39
- foo == "foo"
40
- end
41
- end
42
-
43
- describe "something" do
44
- it "does something" do
45
- "foo".should bar
46
- end
47
- end
48
- """
49
- When I run `rspec ./example_spec.rb`
50
- Then the output should contain "1 example, 1 failure"
51
- And the output should match /undefined.*method/
52
- And the output should contain "RSpec::Matchers::DSL::Matcher"
53
- And the output should not contain "ExampleGroup"
@@ -1,27 +0,0 @@
1
- Feature: define diffable matcher
2
-
3
- When a matcher is defined as diffable, and the --diff
4
- flag is set, the output will include a diff of the submitted
5
- objects.
6
-
7
- @wip
8
- Scenario: define a diffable matcher
9
- Given a file named "diffable_matcher_spec.rb" with:
10
- """ruby
11
- RSpec::Matchers.define :be_just_like do |expected|
12
- match do |actual|
13
- actual == expected
14
- end
15
-
16
- diffable
17
- end
18
-
19
- describe "this" do
20
- it {should be_just_like("that")}
21
- end
22
- """
23
- When I run `rspec ./diffable_matcher_spec.rb --diff`
24
- Then the exit status should not be 0
25
-
26
- And the output should contain "should be just like that"
27
- And the output should contain "Diff:\n@@ -1,2 +1,2 @@\n-that\n+this"