given_core 3.0.0.beta.3 → 3.0.0.beta.4
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.
- checksums.yaml +4 -4
- data/README.md +83 -55
- data/Rakefile +4 -1
- data/lib/given/extensions.rb +34 -22
- data/lib/given/failure.rb +7 -1
- data/lib/given/failure_matcher.rb +50 -13
- data/lib/given/minitest/configure.rb +2 -1
- data/lib/given/rspec/configure.rb +1 -0
- data/lib/given/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bb2de1d0ef168f096a0c169b3e7374c7ba30d785
|
4
|
+
data.tar.gz: e7ad7adad7bcafbedc3b7b71de4fa76a55d23c3f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c5ba77de5d6d12fc167409b9f492e358619ddf7749c44158ffa67043480e6eea3b0cca50afe4c860a9a1393e049817f6c0ffb1ab69a8fc9e37a84b9160d34515
|
7
|
+
data.tar.gz: a4693b820a814b98a485e232b42dfee6533aa4f069d208f363abe140f1656b9636ffa9b656d926fe622ac02af35b0b92023d67097dc2537386827faefc8aaf0a
|
data/README.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
#
|
1
|
+
# Given/When/Then for RSpec and Minitest
|
2
2
|
|
3
3
|
| Master |
|
4
4
|
| :----: |
|
@@ -28,7 +28,7 @@ The rspec-given gem is the original given/when/then extension for
|
|
28
28
|
RSpec. It now depends on a given_core gem for the basic functionality
|
29
29
|
and then adds the RSpec specific code.
|
30
30
|
|
31
|
-
* rspec-given now
|
31
|
+
* rspec-given now requires RSpec version 2.12 or better.
|
32
32
|
|
33
33
|
### Minitest/Given
|
34
34
|
|
@@ -58,7 +58,7 @@ things to watch out for:
|
|
58
58
|
|
59
59
|
### Auto Selecting
|
60
60
|
|
61
|
-
If you
|
61
|
+
If you use natural assertions exclusively in your specs, it's quite
|
62
62
|
possible to write specs that run under both RSpec and Minitest::Spec.
|
63
63
|
|
64
64
|
Use this at the start of your spec file:
|
@@ -94,22 +94,22 @@ describe Stack do
|
|
94
94
|
end
|
95
95
|
|
96
96
|
Given(:stack) { stack_with(initial_contents) }
|
97
|
-
Invariant { stack.empty
|
97
|
+
Invariant { stack.empty? == (stack.depth == 0) }
|
98
98
|
|
99
99
|
context "with no items" do
|
100
100
|
Given(:initial_contents) { [] }
|
101
|
-
Then { stack.depth
|
101
|
+
Then { stack.depth == 0 }
|
102
102
|
|
103
103
|
context "when pushing" do
|
104
104
|
When { stack.push(:an_item) }
|
105
105
|
|
106
|
-
Then { stack.depth
|
107
|
-
Then { stack.top
|
106
|
+
Then { stack.depth == 1 }
|
107
|
+
Then { stack.top == :an_item }
|
108
108
|
end
|
109
109
|
|
110
110
|
context "when popping" do
|
111
111
|
When(:result) { stack.pop }
|
112
|
-
Then { result
|
112
|
+
Then { result == Failure(Stack::UnderflowError, /empty/) }
|
113
113
|
end
|
114
114
|
end
|
115
115
|
|
@@ -119,8 +119,8 @@ describe Stack do
|
|
119
119
|
context "when popping" do
|
120
120
|
When(:pop_result) { stack.pop }
|
121
121
|
|
122
|
-
Then { pop_result
|
123
|
-
Then { stack.depth
|
122
|
+
Then { pop_result == :an_item }
|
123
|
+
Then { stack.depth == 0 }
|
124
124
|
end
|
125
125
|
end
|
126
126
|
|
@@ -131,16 +131,16 @@ describe Stack do
|
|
131
131
|
context "when pushing" do
|
132
132
|
When { stack.push(:new_item) }
|
133
133
|
|
134
|
-
Then { stack.top
|
135
|
-
Then { stack.depth
|
134
|
+
Then { stack.top == :new_item }
|
135
|
+
Then { stack.depth == original_depth + 1 }
|
136
136
|
end
|
137
137
|
|
138
138
|
context "when popping" do
|
139
139
|
When(:pop_result) { stack.pop }
|
140
140
|
|
141
|
-
Then { pop_result
|
142
|
-
Then { stack.top
|
143
|
-
Then { stack.depth
|
141
|
+
Then { pop_result == :top_item }
|
142
|
+
Then { stack.top == :second_item }
|
143
|
+
Then { stack.depth == original_depth - 1 }
|
144
144
|
end
|
145
145
|
end
|
146
146
|
end
|
@@ -307,7 +307,7 @@ should use an empty _Then_ clause, like this:
|
|
307
307
|
#### Then examples:
|
308
308
|
|
309
309
|
```ruby
|
310
|
-
Then { stack.
|
310
|
+
Then { stack.empty? }
|
311
311
|
```
|
312
312
|
|
313
313
|
After the related block for the _When_ clause is run, the stack should
|
@@ -354,9 +354,9 @@ stick with _Then_ clauses.
|
|
354
354
|
#### Then/And examples:
|
355
355
|
|
356
356
|
```ruby
|
357
|
-
Then { pop_result
|
358
|
-
And { stack.top
|
359
|
-
And { stack.depth
|
357
|
+
Then { pop_result == :top_item } # Required
|
358
|
+
And { stack.top == :second_item } # No Setup rerun
|
359
|
+
And { stack.depth == original_depth - 1 } # ... for these
|
360
360
|
```
|
361
361
|
|
362
362
|
### Invariant
|
@@ -420,29 +420,56 @@ clauses and _before_ blocks.
|
|
420
420
|
|
421
421
|
## Natural Assertions
|
422
422
|
|
423
|
-
**NOTE:** <em>Natural assertions are currently an experimental feature
|
424
|
-
of RSpec/Given. They are currently disabled by default, but can be
|
425
|
-
enabled by a simple configuration option (see "use_natural_assertions"
|
426
|
-
below).</em>
|
427
|
-
|
428
423
|
RSpec/Given now supports the use of "natural assertions" in _Then_,
|
429
424
|
_And_, and _Invariant_ blocks. Natural assertions are just Ruby
|
430
425
|
conditionals, without the _should_ or _expect_ methods that RSpec
|
431
|
-
provides. Here are the Then/And examples
|
432
|
-
|
426
|
+
provides. Here are the Then/And examples showing natural assertions:
|
427
|
+
|
428
|
+
### Using Natural Assertions
|
429
|
+
|
430
|
+
```ruby
|
431
|
+
Then { stack.top == :second_item }
|
432
|
+
Then { stack.depth == original_depth - 1 }
|
433
|
+
Then { result == Failure(Stack::UnderflowError, /empty/) }
|
434
|
+
```
|
435
|
+
|
436
|
+
### Using RSpec expect().to
|
433
437
|
|
434
438
|
```ruby
|
435
|
-
Then {
|
436
|
-
|
437
|
-
|
439
|
+
Then { expect(stack.top).to eq(:second_item) }
|
440
|
+
Then { expect(stack.depth).to eq(original_depth - 1) }
|
441
|
+
Then { expect(result).to have_failed(Stack::UnderflowError, /empty/) }
|
438
442
|
```
|
439
443
|
|
440
|
-
|
441
|
-
context basis, to be recognized.
|
444
|
+
### Using Minitest asserts
|
442
445
|
|
443
|
-
|
444
|
-
|
445
|
-
|
446
|
+
```ruby
|
447
|
+
Then { assert_equal :second_item, stack.top }
|
448
|
+
Then { assert_equal original_depth - 1, stack.depth }
|
449
|
+
Then {
|
450
|
+
assert_raises(Stack::UnderflowError, /empty/) do
|
451
|
+
result.call()
|
452
|
+
end
|
453
|
+
}
|
454
|
+
```
|
455
|
+
|
456
|
+
### Using Minitest expectations
|
457
|
+
|
458
|
+
```ruby
|
459
|
+
Then { stack.top.must_equal :second_item }
|
460
|
+
Then { stack.depth.must_equal original_depth - 1}
|
461
|
+
Then { result.must_raise(Stack::UnderflowError, /empty/) }
|
462
|
+
```
|
463
|
+
|
464
|
+
### Disabling Natural Assertions
|
465
|
+
|
466
|
+
Natural assertions may be disabled, either globally or on a per
|
467
|
+
context basis. See the **configuration** section below to see how to
|
468
|
+
disable natural assertions project wide.
|
469
|
+
|
470
|
+
Here's a heads up: If you use natural assertions, but configure Given
|
471
|
+
to disable them, then all your specs will mysteriously pass. This is
|
472
|
+
why the **red** part of _Red/Green/Refactor_ is so important.
|
446
473
|
|
447
474
|
### Failure Messages with Natural Assertions
|
448
475
|
|
@@ -552,19 +579,18 @@ problems with And clauses.
|
|
552
579
|
|
553
580
|
### Mixing Natural Assertions and RSpec Assertions
|
554
581
|
|
555
|
-
Natural assertions
|
556
|
-
intermixed in a single test suite, even within a single
|
557
|
-
|
558
|
-
must be explicitly enabled before they will be considered.
|
559
|
-
|
560
|
-
To enable natural assertions in a context, call the
|
561
|
-
_use_natural_assertions_ method in that context. For example:
|
582
|
+
Natural assertions, RSpec should assertions and Minitest assertions
|
583
|
+
can be intermixed in a single test suite, even within a single
|
584
|
+
context.
|
562
585
|
|
563
586
|
```ruby
|
564
587
|
context "Outer" do
|
565
|
-
use_natural_assertions
|
566
|
-
|
567
588
|
context "Inner" do
|
589
|
+
Then { a == b } # Natural Assertions
|
590
|
+
Then { a.should == b } # RSpec style
|
591
|
+
Then { expect(a).to eq(b) } # RSpec style
|
592
|
+
Then { assert_equal b, a } # Minitest style
|
593
|
+
Then { a.must_equal b } # Minitest style
|
568
594
|
end
|
569
595
|
|
570
596
|
context "Disabled" do
|
@@ -577,7 +603,7 @@ Both the _Outer_ and _Inner_ contexts will use natural assertions. The
|
|
577
603
|
_Disabled_ context overrides the setting inherited from _Outer_ and
|
578
604
|
will not process natural assertions.
|
579
605
|
|
580
|
-
See the **configuration** section below to see how to
|
606
|
+
See the **configuration** section below to see how to disable natural
|
581
607
|
assertions project wide.
|
582
608
|
|
583
609
|
### Matchers and Natural Assertions
|
@@ -622,7 +648,7 @@ There are several ways of creating fuzzy numbers:
|
|
622
648
|
|
623
649
|
* <code>about(n)</code> -- Same as <code>about(n).epsilon(10)</code>.
|
624
650
|
|
625
|
-
When the file <code>
|
651
|
+
When the file <code>given/fuzzy_shortcuts</code> is required,
|
626
652
|
the following unicode shortcut methods are added to Numeric to create
|
627
653
|
fuzzy numbers.
|
628
654
|
|
@@ -648,7 +674,7 @@ For example, the following two Then clauses are equivalent:
|
|
648
674
|
Then { result.should have_failed(StandardError, /message/) }
|
649
675
|
|
650
676
|
# Using natural assertions
|
651
|
-
Then { result ==
|
677
|
+
Then { result == Failure(StandardError, /message/) }
|
652
678
|
```
|
653
679
|
|
654
680
|
### Processing Natural Assertions
|
@@ -662,7 +688,9 @@ following are true:
|
|
662
688
|
1. The block returns false (blocks that return true pass the
|
663
689
|
assertion and don't need a failure message).
|
664
690
|
|
665
|
-
1. The block does not use
|
691
|
+
1. The block does not use the native frameworks assertions or
|
692
|
+
expectations (e.g. RSpec's _should_ or _expect_ methods, or
|
693
|
+
Minitest's _assert\_xxx_ or _must\_xxx_ methods).
|
666
694
|
|
667
695
|
Detecting that last point (the use of _should_ and _expect_) is done
|
668
696
|
by modifying the RSpec runtime to report uses of _should_ and
|
@@ -672,11 +700,11 @@ _expect_.
|
|
672
700
|
|
673
701
|
Natural assertions use the Ripper library to parse the failing
|
674
702
|
condition and find all the sub-expression values upon a failure.
|
675
|
-
Currently Ripper is not supported on JRuby 1.7.
|
676
|
-
said that Ripper support is coming soon and may arrive
|
677
|
-
|
678
|
-
|
679
|
-
|
703
|
+
Currently Ripper is not fully supported on JRuby 1.7.4. Charles Nutter
|
704
|
+
has said that Ripper support is coming soon and may arrive soon. Until
|
705
|
+
then, natural assertions are disabled when running under JRuby. Never
|
706
|
+
fear, JRuby supports all the other features of rspec-given and will
|
707
|
+
work just fine.
|
680
708
|
|
681
709
|
### Further Reading
|
682
710
|
|
@@ -697,7 +725,7 @@ the pretty output and wish to disable source code caching
|
|
697
725
|
unconditionally, then add the following line to your spec helper file:
|
698
726
|
|
699
727
|
```ruby
|
700
|
-
|
728
|
+
Given.source_caching_disabled = true
|
701
729
|
```
|
702
730
|
|
703
731
|
Natural assertions are disabled by default. To globally configure
|
@@ -714,8 +742,8 @@ file:
|
|
714
742
|
|
715
743
|
# License
|
716
744
|
|
717
|
-
|
718
|
-
file in the source distribution.
|
745
|
+
rspec-given, minitest-given and given_core are available under the MIT
|
746
|
+
License. See the MIT-LICENSE file in the source distribution.
|
719
747
|
|
720
748
|
# History
|
721
749
|
|
data/Rakefile
CHANGED
@@ -57,8 +57,11 @@ end
|
|
57
57
|
|
58
58
|
EXAMPLES = FileList['examples/**/*_spec.rb'].
|
59
59
|
exclude('examples/failing/*.rb').
|
60
|
+
exclude('examples/minitest/*.rb').
|
60
61
|
exclude('examples/integration/failing/*.rb')
|
61
62
|
|
63
|
+
MT_EXAMPLES = FileList['examples/minitest/**/*_spec.rb']
|
64
|
+
|
62
65
|
unless Given::NATURAL_ASSERTIONS_SUPPORTED
|
63
66
|
EXAMPLES.exclude("examples/stack/*.rb")
|
64
67
|
end
|
@@ -80,7 +83,7 @@ end
|
|
80
83
|
desc "Run the examples in Minitest"
|
81
84
|
task :mt_examples do
|
82
85
|
puts "Running examples (with Minitest)"
|
83
|
-
sh "ruby -Ilib:examples examples/loader.rb #{EXAMPLES}"
|
86
|
+
sh "ruby -Ilib:examples examples/loader.rb #{EXAMPLES} #{MT_EXAMPLES}"
|
84
87
|
end
|
85
88
|
|
86
89
|
desc "Run failing examples"
|
data/lib/given/extensions.rb
CHANGED
@@ -126,15 +126,19 @@ module Given
|
|
126
126
|
@_Gvn_invariants ||= []
|
127
127
|
end
|
128
128
|
|
129
|
-
|
129
|
+
# List of the and blocks directly in the current describe/context
|
130
|
+
# block.
|
131
|
+
def _Gvn_and_blocks # :nodoc:
|
130
132
|
@_Gvn_and_blocks ||= []
|
131
133
|
end
|
132
134
|
|
133
|
-
|
135
|
+
# Context information ofr the current describe/context block.
|
136
|
+
def _Gvn_context_info # :nodoc:
|
134
137
|
@_Gvn_context_info ||= {}
|
135
138
|
end
|
136
139
|
|
137
|
-
|
140
|
+
# Line extractor for the context.
|
141
|
+
def _Gvn_lines # :nodoc:
|
138
142
|
@_Gvn_lines ||= LineExtractor.new
|
139
143
|
end
|
140
144
|
|
@@ -182,23 +186,34 @@ module Given
|
|
182
186
|
#
|
183
187
|
def When(*args, &block)
|
184
188
|
if args.first.is_a?(Symbol)
|
185
|
-
|
186
|
-
begin
|
187
|
-
_gvn_establish_givens
|
188
|
-
instance_eval(&block)
|
189
|
-
rescue Given.pending_error => ex
|
190
|
-
raise
|
191
|
-
rescue Exception => ex
|
192
|
-
Failure.new(ex)
|
193
|
-
end
|
194
|
-
end
|
195
|
-
_Gvn_before do __send__(args.first) end
|
189
|
+
_Gvn_when_actions_with_capture(args.first, block)
|
196
190
|
else
|
197
|
-
|
191
|
+
_Gvn_when_actions(block)
|
192
|
+
end
|
193
|
+
end
|
194
|
+
|
195
|
+
# Normal When clause actions.
|
196
|
+
def _Gvn_when_actions(block) # :nodoc:
|
197
|
+
_Gvn_before do
|
198
|
+
_gvn_establish_givens
|
199
|
+
instance_eval(&block)
|
200
|
+
end
|
201
|
+
end
|
202
|
+
|
203
|
+
# Normal When clause actions except that exceptions are captured
|
204
|
+
# in a Failure object.
|
205
|
+
def _Gvn_when_actions_with_capture(name, block) # :nodoc:
|
206
|
+
let(name) do
|
207
|
+
begin
|
198
208
|
_gvn_establish_givens
|
199
209
|
instance_eval(&block)
|
210
|
+
rescue Given.pending_error => ex
|
211
|
+
raise
|
212
|
+
rescue Exception => ex
|
213
|
+
Failure.new(ex)
|
200
214
|
end
|
201
215
|
end
|
216
|
+
_Gvn_before do __send__(name) end
|
202
217
|
end
|
203
218
|
|
204
219
|
# Provide an assertion about the specification.
|
@@ -211,14 +226,9 @@ module Given
|
|
211
226
|
# Then { ... assertion ... }
|
212
227
|
#
|
213
228
|
def Then(&block)
|
214
|
-
|
215
|
-
file, line = eval "[__FILE__, __LINE__]", env
|
229
|
+
file, line = eval "[__FILE__, __LINE__]", block.binding
|
216
230
|
description = _Gvn_lines.line(file, line) unless Given.source_caching_disabled
|
217
|
-
|
218
|
-
cmd = "it(description)"
|
219
|
-
else
|
220
|
-
cmd = "specify"
|
221
|
-
end
|
231
|
+
cmd = description ? "it(description)" : "specify"
|
222
232
|
eval %{#{cmd} do _gvn_then(&block) end}, binding, file, line
|
223
233
|
_Gvn_context_info[:then_defined] = true
|
224
234
|
end
|
@@ -229,11 +239,13 @@ module Given
|
|
229
239
|
_Gvn_invariants << block
|
230
240
|
end
|
231
241
|
|
242
|
+
# Provide an assertion that shares setup with a peer Then command.
|
232
243
|
def And(&block)
|
233
244
|
fail "And defined without a Then" unless _Gvn_context_info[:then_defined]
|
234
245
|
_Gvn_and_blocks << block
|
235
246
|
end
|
236
247
|
|
248
|
+
# Configure the use of natural assertions in this context.
|
237
249
|
def use_natural_assertions(enabled=true)
|
238
250
|
Given.ok_to_use_natural_assertions(enabled)
|
239
251
|
_Gvn_context_info[:natural_assertions_enabled] = enabled
|
data/lib/given/failure.rb
CHANGED
@@ -6,6 +6,12 @@ module Given
|
|
6
6
|
class Failure < BasicObject
|
7
7
|
undef_method :==, :!=, :!
|
8
8
|
|
9
|
+
def must_raise(*args)
|
10
|
+
::Minitest::Spec.current.assert_raises(*args) do
|
11
|
+
die
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
9
15
|
def initialize(exception)
|
10
16
|
@exception = exception
|
11
17
|
end
|
@@ -49,7 +55,7 @@ module Given
|
|
49
55
|
|
50
56
|
def failure_matcher?(other)
|
51
57
|
other.is_a?(::Given::FailureMatcher) ||
|
52
|
-
other.is_a?(::RSpec::Given::HaveFailed::HaveFailedMatcher)
|
58
|
+
(defined?(::RSpec) && other.is_a?(::RSpec::Given::HaveFailed::HaveFailedMatcher))
|
53
59
|
end
|
54
60
|
|
55
61
|
end
|
@@ -10,13 +10,29 @@ module Given
|
|
10
10
|
@no_pattern = true
|
11
11
|
elsif @expected_message_pattern.is_a?(String)
|
12
12
|
@expected_message_pattern =
|
13
|
-
Regexp.new("\\A" + Regexp.quote(@expected_message_pattern) + "\\
|
13
|
+
Regexp.new("\\A" + Regexp.quote(@expected_message_pattern) + "\\z")
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
def ==(other)
|
18
|
+
if other.respond_to?(:call)
|
19
|
+
matches?(other)
|
20
|
+
else
|
21
|
+
super
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
def !=(other)
|
26
|
+
if other.respond_to?(:call)
|
27
|
+
does_not_match?(other)
|
28
|
+
else
|
29
|
+
super
|
14
30
|
end
|
15
31
|
end
|
16
32
|
|
17
33
|
def matches?(possible_failure)
|
18
34
|
if possible_failure.respond_to?(:call)
|
19
|
-
|
35
|
+
match_or_fail(possible_failure)
|
20
36
|
else
|
21
37
|
Given.fail_with("#{description}, but nothing failed")
|
22
38
|
end
|
@@ -24,34 +40,55 @@ module Given
|
|
24
40
|
|
25
41
|
def does_not_match?(possible_failure)
|
26
42
|
if possible_failure.respond_to?(:call)
|
27
|
-
|
43
|
+
mismatch_or_fail(possible_failure)
|
28
44
|
else
|
29
45
|
true
|
30
46
|
end
|
31
47
|
end
|
32
48
|
|
49
|
+
def inspect
|
50
|
+
result = "<Failure on #{@expected_exception_class}"
|
51
|
+
result << " matching #{@expected_message_pattern.inspect}" unless @no_pattern
|
52
|
+
result << ">"
|
53
|
+
end
|
54
|
+
|
33
55
|
private
|
34
56
|
|
35
|
-
def
|
57
|
+
def match_or_fail(possible_failure)
|
58
|
+
ex = extract_exception(possible_failure)
|
59
|
+
match_exception(ex) ||
|
60
|
+
Given.fail_with("#{description}, but got #{ex.inspect}")
|
61
|
+
end
|
62
|
+
|
63
|
+
def mismatch_or_fail(possible_failure)
|
64
|
+
ex = extract_exception(possible_failure)
|
65
|
+
(! match_exception(ex)) ||
|
66
|
+
Given.fail_with("#{unexpected_description}, but got #{ex.inspect}")
|
67
|
+
end
|
68
|
+
|
69
|
+
def match_exception(ex)
|
70
|
+
ex.is_a?(@expected_exception_class) && @expected_message_pattern =~ ex.message
|
71
|
+
end
|
72
|
+
|
73
|
+
def extract_exception(possible_failure)
|
36
74
|
possible_failure.call
|
37
75
|
Given.fail_with("Expected an exception")
|
76
|
+
return nil
|
38
77
|
rescue Exception => ex
|
39
|
-
|
40
|
-
Given.fail_with("#{description}, but got #{ex.inspect}")
|
41
|
-
elsif @expected_message_pattern !~ ex.message
|
42
|
-
Given.fail_with("#{description}, but got #{ex.inspect}")
|
43
|
-
else
|
44
|
-
true
|
45
|
-
end
|
78
|
+
return ex
|
46
79
|
end
|
47
80
|
|
48
|
-
private
|
49
|
-
|
50
81
|
def description
|
51
82
|
result = "Expected failure with #{@expected_exception_class}"
|
52
83
|
result << " matching #{@expected_message_pattern.inspect}" unless @no_pattern
|
53
84
|
result
|
54
85
|
end
|
86
|
+
|
87
|
+
def unexpected_description
|
88
|
+
result = "Did not expect failure with #{@expected_exception_class}"
|
89
|
+
result << " matching #{@expected_message_pattern.inspect}" unless @no_pattern
|
90
|
+
result
|
91
|
+
end
|
55
92
|
end
|
56
93
|
|
57
94
|
module FailureMethod
|
@@ -1,6 +1,7 @@
|
|
1
1
|
|
2
2
|
# Configure Minitest to use the Given extensions.
|
3
3
|
|
4
|
-
Minitest::Spec.send(:extend,
|
4
|
+
Minitest::Spec.send(:extend, Given::ClassExtensions)
|
5
5
|
Minitest::Spec.send(:include, Given::FailureMethod)
|
6
6
|
Minitest::Spec.send(:include, Given::InstanceExtensions)
|
7
|
+
Given.use_natural_assertions if Given::NATURAL_ASSERTIONS_SUPPORTED
|
data/lib/given/version.rb
CHANGED