rspec-given 3.7.1 → 3.8.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +13 -13
- data/README.md +26 -6
- data/Rakefile +0 -4
- data/examples/integration/failing_messages_spec.rb +10 -4
- data/examples/integration/then_spec.rb +1 -2
- data/examples/minitest_helper.rb +3 -8
- data/examples/use_assertions.rb +33 -36
- data/spec/lib/given/assertions_spec.rb +0 -2
- data/spec/lib/given/ext/numeric_spec.rb +0 -1
- data/spec/lib/given/ext/numeric_specifications.rb +0 -1
- data/spec/lib/given/extensions_spec.rb +16 -9
- data/spec/lib/given/failure_matcher_spec.rb +0 -1
- data/spec/lib/given/failure_spec.rb +0 -3
- data/spec/lib/given/fuzzy_number_spec.rb +0 -1
- data/spec/lib/given/have_failed_spec.rb +0 -1
- data/spec/lib/given/lexical_purity_spec.rb +0 -1
- data/spec/lib/given/line_extractor_spec.rb +4 -0
- data/spec/lib/given/module_methods_spec.rb +2 -8
- data/spec/lib/given/natural_assertion_spec.rb +15 -4
- data/spec/lib/given/options_spec.rb +2 -8
- data/spec/spec_helper.rb +12 -0
- data/spec/support/natural_assertion_control.rb +4 -10
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a4b2f4dfa0869eb20c5b477aafd2728f11cc8758
|
4
|
+
data.tar.gz: 832cf482cc2583f05420179b8734d85b89ebadc6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 670739df226ed276d59dd21902994ff4b424481ed996a9e2f166a56e85e6df877f766575f32b431ed289f393ae0b27afb6bafdd98304a1ac30533d687fb53298
|
7
|
+
data.tar.gz: 730d1d3d3a1918c46dca275597377e77c8779058b5d5f2da9bf01d78026940668ec5ef3e7ff73eb2ca326e2450cb3972b6f178b8ddefdf6dee99234b5803a81e
|
data/Gemfile.lock
CHANGED
@@ -2,21 +2,21 @@ GEM
|
|
2
2
|
remote: https://rubygems.org/
|
3
3
|
specs:
|
4
4
|
diff-lcs (1.2.5)
|
5
|
-
minitest (5.
|
6
|
-
rake (10.
|
7
|
-
rspec (3.
|
8
|
-
rspec-core (~> 3.
|
9
|
-
rspec-expectations (~> 3.
|
10
|
-
rspec-mocks (~> 3.
|
11
|
-
rspec-core (3.
|
12
|
-
rspec-support (~> 3.
|
13
|
-
rspec-expectations (3.
|
5
|
+
minitest (5.8.3)
|
6
|
+
rake (10.5.0)
|
7
|
+
rspec (3.4.0)
|
8
|
+
rspec-core (~> 3.4.0)
|
9
|
+
rspec-expectations (~> 3.4.0)
|
10
|
+
rspec-mocks (~> 3.4.0)
|
11
|
+
rspec-core (3.4.1)
|
12
|
+
rspec-support (~> 3.4.0)
|
13
|
+
rspec-expectations (3.4.0)
|
14
14
|
diff-lcs (>= 1.2.0, < 2.0)
|
15
|
-
rspec-support (~> 3.
|
16
|
-
rspec-mocks (3.
|
15
|
+
rspec-support (~> 3.4.0)
|
16
|
+
rspec-mocks (3.4.1)
|
17
17
|
diff-lcs (>= 1.2.0, < 2.0)
|
18
|
-
rspec-support (~> 3.
|
19
|
-
rspec-support (3.
|
18
|
+
rspec-support (~> 3.4.0)
|
19
|
+
rspec-support (3.4.1)
|
20
20
|
sorcerer (1.0.2)
|
21
21
|
|
22
22
|
PLATFORMS
|
data/README.md
CHANGED
@@ -4,7 +4,7 @@
|
|
4
4
|
| :----: |
|
5
5
|
| [![Master Build Status](https://secure.travis-ci.org/rspec-given/rspec-given.png?branch=master)](https://travis-ci.org/rspec-given/rspec-given) |
|
6
6
|
|
7
|
-
Covering rspec-given, minitest-given, and given-core, version 3.
|
7
|
+
Covering rspec-given, minitest-given, and given-core, version 3.8.0.
|
8
8
|
|
9
9
|
rspec-given and minitest-given are extensions to your favorite testing
|
10
10
|
framework to allow Given/When/Then notation when writing specs.
|
@@ -347,6 +347,17 @@ should use an empty _Then_ clause, like this:
|
|
347
347
|
Then { }
|
348
348
|
```
|
349
349
|
|
350
|
+
A _Then_ clause accepts arguments for user-defined RSpec metadata:
|
351
|
+
|
352
|
+
```ruby
|
353
|
+
Then(:zippy, :foo => 17) { ... }
|
354
|
+
```
|
355
|
+
|
356
|
+
Metadata on _Then_ clauses is an RSpec-only feature. You can read more about
|
357
|
+
metadata [in RSpec's
|
358
|
+
documentation](https://www.relishapp.com/rspec/rspec-core/docs/metadata/user-defined-metadata).
|
359
|
+
|
360
|
+
|
350
361
|
#### Then examples:
|
351
362
|
|
352
363
|
```ruby
|
@@ -760,12 +771,13 @@ _expect_.
|
|
760
771
|
|
761
772
|
Given uses the Ripper library to parse the source lines and failing
|
762
773
|
conditions to find all the sub-expression values upon a failure.
|
763
|
-
Currently Ripper is not supported on Rubinius and versions of JRuby
|
764
|
-
prior to JRuby-1.7.5.
|
765
774
|
|
766
|
-
If
|
767
|
-
|
768
|
-
|
775
|
+
If Ripper is not available, like on Rubinius and versions of JRuby prior to
|
776
|
+
JRuby-1.7.5, detailed explanations of failures for natural assertions won't be
|
777
|
+
available. Natural assertions will still work, though.
|
778
|
+
|
779
|
+
If you want to use a version of Ruby that does not support Ripper, then you
|
780
|
+
should disable source caching in the configuration (see the configuration
|
769
781
|
section below).
|
770
782
|
|
771
783
|
### Non-Spec Assertions
|
@@ -870,6 +882,14 @@ License. See the MIT-LICENSE file in the source distribution.
|
|
870
882
|
|
871
883
|
# History
|
872
884
|
|
885
|
+
* Version 3.8.0
|
886
|
+
|
887
|
+
* RSpec metadata can now be added to _Then_ clauses (see [#11](https://github.com/rspec-given/rspec-given/pull/11))
|
888
|
+
* Natural assertions now run on Rubinius and older versions of JRuby (see [#15](https://github.com/rspec-given/rspec-given/issues/15))
|
889
|
+
* WARNING: On these platforms, detailed failure explanations aren't available and source code snippets of Then clauses will only show the first line.
|
890
|
+
* WARNING: Assertions of void statements (e.g. `Then { }`) will fail only under runtimes lacking Ripper support
|
891
|
+
* `Given.ok_to_use_natural_assertions` was removed; the method was never properly supported as public, but it was publicly reachable
|
892
|
+
|
873
893
|
* Version 3.7.1
|
874
894
|
|
875
895
|
* Mixin Minitest extensions for both ActiveSupport::TestCase (when present) as well as for MiniTest::Spec (see [#8](https://github.com/rspec-given/rspec-given/pulls/8))
|
data/Rakefile
CHANGED
@@ -67,10 +67,6 @@ EXAMPLES = FileList['examples/**/*_spec.rb', 'examples/use_assertions.rb'].
|
|
67
67
|
|
68
68
|
MT_EXAMPLES = FileList['examples/minitest-rails/**/*_spec.rb', 'examples/minitest/**/*_spec.rb']
|
69
69
|
|
70
|
-
unless Given::NATURAL_ASSERTIONS_SUPPORTED
|
71
|
-
EXAMPLES.exclude("examples/stack/*.rb")
|
72
|
-
end
|
73
|
-
|
74
70
|
FAILING_EXAMPLES = FileList['examples/failing/**/*_spec.rb']
|
75
71
|
|
76
72
|
desc "Run the RSpec specs and examples"
|
@@ -2,24 +2,28 @@ require 'example_helper'
|
|
2
2
|
require 'open3'
|
3
3
|
|
4
4
|
describe "Failing Messages" do
|
5
|
-
use_natural_assertions_if_supported
|
6
|
-
|
7
5
|
IOS = Struct.new(:out, :err)
|
8
6
|
|
9
7
|
def run_spec(filename)
|
10
|
-
|
8
|
+
_inn, out, err, _wait = Open3.popen3(
|
9
|
+
"rspec", "examples/integration/failing/#{filename}",
|
10
|
+
# Ensure our `project_source_dirs` config is set when we shell out to RSpec.
|
11
|
+
"-rexample_helper"
|
12
|
+
)
|
11
13
|
IOS.new(out.read, err.read)
|
12
14
|
end
|
13
15
|
|
14
16
|
When(:ios) { run_spec(failing_test) }
|
15
17
|
|
16
18
|
context "when referencing constants from nested modules" do
|
19
|
+
skip_natural_assertions_if_not_supported
|
17
20
|
Given(:failing_test) { "module_nesting_spec.rb" }
|
18
21
|
Then { ios.err == "" }
|
19
22
|
And { ios.out !~ /uninitialized constant RSpec::Given::InstanceExtensions::X/ }
|
20
23
|
end
|
21
24
|
|
22
25
|
context "when referencing undefined methods" do
|
26
|
+
skip_natural_assertions_if_not_supported
|
23
27
|
Given(:failing_test) { "undefined_method_spec.rb" }
|
24
28
|
Then { ios.err == "" }
|
25
29
|
And { complains_xyz_is_not_in_scope?(ios.out) }
|
@@ -35,6 +39,7 @@ describe "Failing Messages" do
|
|
35
39
|
end
|
36
40
|
|
37
41
|
context "when breaking down expressions" do
|
42
|
+
skip_natural_assertions_if_not_supported
|
38
43
|
Given(:failing_test) { "eval_subexpression_spec.rb" }
|
39
44
|
Then { ios.err == "" }
|
40
45
|
And { ios.out =~ /false *<- array\[index\]\.upcase == value$/ }
|
@@ -51,8 +56,9 @@ describe "Failing Messages" do
|
|
51
56
|
end
|
52
57
|
|
53
58
|
context "with an oddly formatted then" do
|
59
|
+
skip_natural_assertions_if_not_supported
|
54
60
|
Given(:failing_test) { "oddly_formatted_then.rb" }
|
55
|
-
Then { ios.out =~ /Failure\/Error
|
61
|
+
Then { ios.out =~ /Failure\/Error:\s*Then \{ result == \['a',$/ }
|
56
62
|
And { ios.out =~ /expected: "anything"/ }
|
57
63
|
And { ios.out =~ /to equal: \["a", "a"\]/ }
|
58
64
|
end
|
@@ -11,11 +11,10 @@ end
|
|
11
11
|
|
12
12
|
describe "Then" do
|
13
13
|
context "empty thens with natural assertions" do
|
14
|
-
|
14
|
+
skip_natural_assertions_if_not_supported #<--we can't detect void statements
|
15
15
|
Then { }
|
16
16
|
end
|
17
17
|
context "thens to_bool/true will pass" do
|
18
|
-
use_natural_assertions_if_supported
|
19
18
|
Then { ToBool.new(true) }
|
20
19
|
end
|
21
20
|
end
|
data/examples/minitest_helper.rb
CHANGED
@@ -1,4 +1,3 @@
|
|
1
|
-
|
2
1
|
module GivenAssertions
|
3
2
|
def given_assert(cond)
|
4
3
|
assert cond
|
@@ -23,13 +22,9 @@ module GivenAssertions
|
|
23
22
|
end
|
24
23
|
|
25
24
|
module NaturalAssertionControl
|
26
|
-
def
|
27
|
-
if
|
28
|
-
Given {
|
29
|
-
skip "Natural assertions are not supported in JRuby"
|
30
|
-
}
|
31
|
-
else
|
32
|
-
use_natural_assertions(enabled)
|
25
|
+
def skip_natural_assertions_if_not_supported
|
26
|
+
if !Given::NATURAL_ASSERTIONS_SUPPORTED
|
27
|
+
Given { skip "This test requires a Ruby runtime with full natural assertions support." }
|
33
28
|
end
|
34
29
|
end
|
35
30
|
end
|
data/examples/use_assertions.rb
CHANGED
@@ -1,47 +1,44 @@
|
|
1
1
|
require 'given/module_methods'
|
2
2
|
|
3
|
-
|
3
|
+
require 'given/assertions'
|
4
|
+
require 'given/fuzzy_number'
|
4
5
|
|
5
|
-
|
6
|
-
|
6
|
+
include Given::Assertions
|
7
|
+
include Given::Fuzzy
|
7
8
|
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
Postcondition { result ** 2 == about(n) }
|
15
|
-
result
|
16
|
-
end
|
9
|
+
def sqrt(n)
|
10
|
+
Precondition { n >= 0 }
|
11
|
+
result = Math.sqrt(n)
|
12
|
+
Postcondition { result ** 2 == about(n) }
|
13
|
+
result
|
14
|
+
end
|
17
15
|
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
16
|
+
def sqrt_bad_postcondition(n)
|
17
|
+
Precondition { n >= 0 }
|
18
|
+
result = Math.sqrt(n)
|
19
|
+
Postcondition { result ** 2 == about(n+1) }
|
20
|
+
result
|
21
|
+
end
|
24
22
|
|
25
|
-
|
26
|
-
|
27
|
-
|
23
|
+
def use_assert(n)
|
24
|
+
Assert { n == 1 }
|
25
|
+
end
|
28
26
|
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
end
|
27
|
+
def should_fail
|
28
|
+
begin
|
29
|
+
yield
|
30
|
+
fail "Expected error"
|
31
|
+
rescue Given::Assertions::AssertError => ex
|
32
|
+
true
|
36
33
|
end
|
34
|
+
end
|
37
35
|
|
38
|
-
|
39
|
-
|
40
|
-
|
36
|
+
sqrt(1)
|
37
|
+
sqrt(2)
|
38
|
+
sqrt(0)
|
41
39
|
|
42
|
-
|
43
|
-
|
40
|
+
should_fail { sqrt(-1) }
|
41
|
+
should_fail { sqrt_bad_postcondition(1) }
|
44
42
|
|
45
|
-
|
46
|
-
|
47
|
-
end
|
43
|
+
use_assert(1)
|
44
|
+
should_fail { use_assert(0) }
|
@@ -187,18 +187,25 @@ describe Given::ClassExtensions do
|
|
187
187
|
And { expect(trace).to eq([:given, :then, :and]) }
|
188
188
|
end
|
189
189
|
|
190
|
+
describe "Adding metadata to Then & And (RSpec 2+)" do
|
191
|
+
Given(:test) { RSpec.respond_to?(:current_example) ? RSpec.method(:current_example) : method(:example) }
|
192
|
+
Then(:key => :val) { test.call.metadata[:key] == :val }
|
193
|
+
And { test.call.metadata[:key] == :val }
|
194
|
+
|
195
|
+
if rspec_3_or_later?
|
196
|
+
describe "Supporting default-to-true metadata symbols (RSpec 3 only)" do
|
197
|
+
Then(:magic, :foo => :bar) { test.call.metadata[:magic] == true }
|
198
|
+
And { test.call.metadata[:foo] == :bar }
|
199
|
+
end
|
200
|
+
end
|
201
|
+
|
202
|
+
end
|
190
203
|
end
|
191
204
|
|
192
205
|
describe "use_natural_assertions" do
|
193
|
-
|
194
|
-
CONTEXT = self
|
206
|
+
CONTEXT = self
|
195
207
|
|
196
|
-
|
208
|
+
When(:result) { CONTEXT.use_natural_assertions }
|
197
209
|
|
198
|
-
|
199
|
-
Then { expect(result).to_not have_failed }
|
200
|
-
else
|
201
|
-
Then { expect(result).to have_failed(ArgumentError) }
|
202
|
-
end
|
203
|
-
end
|
210
|
+
Then { expect(result).to_not have_failed }
|
204
211
|
end
|
@@ -27,21 +27,18 @@ describe Given::Failure do
|
|
27
27
|
end
|
28
28
|
|
29
29
|
describe "== have_failed" do
|
30
|
-
use_natural_assertions_if_supported
|
31
30
|
Then { failure == have_failed(StandardError, "Oops") }
|
32
31
|
Then { failure == have_failed(StandardError) }
|
33
32
|
Then { failure == have_failed }
|
34
33
|
end
|
35
34
|
|
36
35
|
describe "== Failure" do
|
37
|
-
use_natural_assertions_if_supported
|
38
36
|
Then { failure == Failure(StandardError, "Oops") }
|
39
37
|
Then { failure == Failure(StandardError) }
|
40
38
|
Then { failure == Failure() }
|
41
39
|
end
|
42
40
|
|
43
41
|
describe "!= Failure" do
|
44
|
-
use_natural_assertions_if_supported
|
45
42
|
Then { expect { failure != Object.new }.to raise_error(StandardError) }
|
46
43
|
Then { failure != Failure(other_error) }
|
47
44
|
end
|
@@ -44,6 +44,7 @@ module Given
|
|
44
44
|
end
|
45
45
|
|
46
46
|
context "when the Then is split over several lines with {}" do
|
47
|
+
skip_natural_assertions_if_not_supported
|
47
48
|
Given(:input) {
|
48
49
|
"describe 'foobar' do\n" +
|
49
50
|
" Then {\n" +
|
@@ -55,6 +56,7 @@ module Given
|
|
55
56
|
end
|
56
57
|
|
57
58
|
context "when the Then is has blank lines" do
|
59
|
+
skip_natural_assertions_if_not_supported
|
58
60
|
Given(:input) {
|
59
61
|
"describe 'foobar' do\n" +
|
60
62
|
" Then {\n\n" +
|
@@ -66,6 +68,7 @@ module Given
|
|
66
68
|
end
|
67
69
|
|
68
70
|
context "when the Then is split over several lines with do/end" do
|
71
|
+
skip_natural_assertions_if_not_supported
|
69
72
|
Given(:input) {
|
70
73
|
"describe 'foobar' do\n" +
|
71
74
|
" Then do\n" +
|
@@ -77,6 +80,7 @@ module Given
|
|
77
80
|
end
|
78
81
|
|
79
82
|
context "when the Then is oddly formatted" do
|
83
|
+
skip_natural_assertions_if_not_supported
|
80
84
|
Given(:input) {
|
81
85
|
"describe 'foobar' do\n" +
|
82
86
|
" Then { result == ['a',\n" +
|
@@ -1,13 +1,7 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
describe "RSpec::Given.use_natural_assertions" do
|
4
|
-
|
5
|
-
When(:result) { ::Given.use_natural_assertions }
|
4
|
+
When(:result) { ::Given.use_natural_assertions }
|
6
5
|
|
7
|
-
|
8
|
-
Then { expect(result).to_not have_failed }
|
9
|
-
else
|
10
|
-
Then { expect(result).to have_failed(ArgumentError) }
|
11
|
-
end
|
12
|
-
end
|
6
|
+
Then { expect(result).to_not have_failed }
|
13
7
|
end
|
@@ -1,13 +1,19 @@
|
|
1
1
|
require 'rspec/given'
|
2
2
|
require 'spec_helper'
|
3
3
|
|
4
|
-
describe Given::
|
5
|
-
|
6
|
-
|
4
|
+
describe Given::NATURAL_ASSERTIONS_SUPPORTED do
|
5
|
+
if (defined?(RUBY_ENGINE) && RUBY_ENGINE == 'rbx') || (defined?(JRUBY_VERSION) &&
|
6
|
+
Gem::Version.new(JRUBY_VERSION) < Gem::Version.new('1.7.5'))
|
7
|
+
Then { Given::NATURAL_ASSERTIONS_SUPPORTED == false }
|
8
|
+
else
|
9
|
+
Then { Given::NATURAL_ASSERTIONS_SUPPORTED == true }
|
7
10
|
end
|
11
|
+
end
|
8
12
|
|
13
|
+
describe Given::NaturalAssertion do
|
9
14
|
describe "#content?" do
|
10
15
|
context "with empty block" do
|
16
|
+
skip_natural_assertions_if_not_supported
|
11
17
|
FauxThen { }
|
12
18
|
Then { expect(na).to_not have_content }
|
13
19
|
end
|
@@ -42,6 +48,7 @@ describe Given::NaturalAssertion do
|
|
42
48
|
end
|
43
49
|
|
44
50
|
describe "failure messages" do
|
51
|
+
skip_natural_assertions_if_not_supported
|
45
52
|
let(:msg) { na.message }
|
46
53
|
Invariant { expect(msg).to match(/^FauxThen expression/) }
|
47
54
|
|
@@ -167,7 +174,11 @@ describe Given::NaturalAssertion do
|
|
167
174
|
ary[1] == 3
|
168
175
|
}
|
169
176
|
When(:result) { na.message }
|
170
|
-
|
177
|
+
if Given::NATURAL_ASSERTIONS_SUPPORTED
|
178
|
+
Then { expect(result).to have_failed(Given::InvalidThenError, /multiple.*statements/i) }
|
179
|
+
else
|
180
|
+
Then { expect(result).to match(/FauxThen expression failed/) }
|
181
|
+
end
|
171
182
|
end
|
172
183
|
|
173
184
|
end
|
@@ -24,12 +24,6 @@ describe "Configuration Options" do
|
|
24
24
|
end
|
25
25
|
|
26
26
|
describe "Global natural assertion configuration" do
|
27
|
-
unless Given::NATURAL_ASSERTIONS_SUPPORTED
|
28
|
-
before do
|
29
|
-
pending "Natural assertions are not supported in JRuby"
|
30
|
-
end
|
31
|
-
end
|
32
|
-
|
33
27
|
before do
|
34
28
|
Given.use_natural_assertions false
|
35
29
|
end
|
@@ -46,7 +40,7 @@ describe "Configuration Options" do
|
|
46
40
|
Then { expect(_gvn_need_na_message?(nassert)).to be_falsy }
|
47
41
|
|
48
42
|
context "overridden locally" do
|
49
|
-
|
43
|
+
use_natural_assertions
|
50
44
|
Then { expect(_gvn_need_na_message?(nassert)).to be_truthy }
|
51
45
|
end
|
52
46
|
end
|
@@ -120,7 +114,7 @@ describe "Configuration Options" do
|
|
120
114
|
Then { expect(_gvn_need_na_message?(nassert)).to be_falsy }
|
121
115
|
|
122
116
|
context "overridden locally" do
|
123
|
-
|
117
|
+
use_natural_assertions
|
124
118
|
Then { expect(_gvn_need_na_message?(nassert)).to be_truthy }
|
125
119
|
end
|
126
120
|
|
data/spec/spec_helper.rb
CHANGED
@@ -1,4 +1,12 @@
|
|
1
1
|
require 'rspec/given'
|
2
|
+
RSpec.configure do |config|
|
3
|
+
# Before RSpec 3.4, RSpec would only print lines in failures from spec files.
|
4
|
+
# Starting in 3.4, it now prints lines from the new `project_source_dirs` config
|
5
|
+
# setting. We want it to print lines from our specs instead of printing
|
6
|
+
# `::RSpec::Expectations.fail_with(*args)` from within lib/given/rspec/framework.rb,
|
7
|
+
# so we remove `lib` from the directories here.
|
8
|
+
config.project_source_dirs -= ["lib"] if config.respond_to?(:project_source_dirs)
|
9
|
+
end
|
2
10
|
|
3
11
|
# Load the support modules.
|
4
12
|
|
@@ -26,3 +34,7 @@ end
|
|
26
34
|
def given_assert_raises(error, pattern=nil, &block)
|
27
35
|
expect(&block).to raise_error(error, pattern)
|
28
36
|
end
|
37
|
+
|
38
|
+
def rspec_3_or_later?
|
39
|
+
Gem::Version.new(RSpec::Version::STRING).segments[0] >= 3
|
40
|
+
end
|
@@ -1,15 +1,9 @@
|
|
1
1
|
module NaturalAssertionControl
|
2
|
-
def
|
3
|
-
if
|
4
|
-
Given {
|
5
|
-
pending "Natural assertions are not supported in JRuby"
|
6
|
-
}
|
7
|
-
else
|
8
|
-
use_natural_assertions(enabled)
|
2
|
+
def skip_natural_assertions_if_not_supported
|
3
|
+
if !Given::NATURAL_ASSERTIONS_SUPPORTED
|
4
|
+
Given { pending "This test requires a Ruby runtime with full natural assertions support." }
|
9
5
|
end
|
10
6
|
end
|
11
7
|
end
|
12
8
|
|
13
|
-
RSpec.configure
|
14
|
-
c.extend(NaturalAssertionControl)
|
15
|
-
end
|
9
|
+
RSpec.configure { |c| c.extend(NaturalAssertionControl) }
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rspec-given
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.
|
4
|
+
version: 3.8.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jim Weirich
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-01-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: given_core
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - '='
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 3.
|
19
|
+
version: 3.8.0
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - '='
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 3.
|
26
|
+
version: 3.8.0
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rspec
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -133,7 +133,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
133
133
|
version: '0'
|
134
134
|
requirements: []
|
135
135
|
rubyforge_project: given
|
136
|
-
rubygems_version: 2.
|
136
|
+
rubygems_version: 2.4.5
|
137
137
|
signing_key:
|
138
138
|
specification_version: 4
|
139
139
|
summary: Given/When/Then Specification Extensions for RSpec.
|