rspec-given 3.2.0 → 3.3.0.beta1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +2 -2
- data/examples/failing/natural_failing_spec.rb +0 -1
- data/examples/integration/failing/to_bool_returns_false.rb +12 -0
- data/examples/integration/failing_messages_spec.rb +5 -0
- data/examples/integration/then_spec.rb +13 -0
- data/spec/lib/given/natural_assertion_spec.rb +24 -0
- data/spec/support/faux_then.rb +4 -0
- metadata +7 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d156c4796f99c95fcc27cb5de2bdad78fc15c352
|
4
|
+
data.tar.gz: a4ceb011c6bb885096f167a55f4a6bea5c5759a6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f4ff481aa6de34a258893ad9f59f8ca8a1e08c8955a6fd7b20b89a104a96e69e9329efb61b64430ba6bfea81628401c297e8ea5e6ea458a922d575ab360d7809
|
7
|
+
data.tar.gz: 5b1628c2e2e19368ee45ae89a568112fd0f24f676cc3a53e2829a766d055dcae7aaacea2fbb2278dd508236740f46440fc4a76d6ed24e7308a47c8d7cfb99532
|
data/README.md
CHANGED
@@ -4,7 +4,7 @@
|
|
4
4
|
| :----: |
|
5
5
|
| [![Master Build Status](https://secure.travis-ci.org/jimweirich/rspec-given.png?branch=master)](https://travis-ci.org/jimweirich/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.3.0.beta1.
|
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.
|
@@ -830,7 +830,7 @@ unconditionally, then add the following line to your spec helper file:
|
|
830
830
|
Given.source_caching_disabled = true
|
831
831
|
```
|
832
832
|
|
833
|
-
Natural assertions are
|
833
|
+
Natural assertions are enabled by default. To globally configure
|
834
834
|
natural assertions, add one of the following lines to your spec_helper
|
835
835
|
file:
|
836
836
|
|
@@ -35,4 +35,9 @@ describe "Failing Messages" do
|
|
35
35
|
And { ios.out =~ /1 *<- index$/ }
|
36
36
|
And { ios.out =~ /"X" *<- value$/ }
|
37
37
|
end
|
38
|
+
|
39
|
+
context "when returning false from ToBool" do
|
40
|
+
Given(:failing_test) { "to_bool_returns_false.rb" }
|
41
|
+
Then { ios.out =~ /Failure\/Error: Then \{ ToBool.new \}/ }
|
42
|
+
end
|
38
43
|
end
|
@@ -1,8 +1,21 @@
|
|
1
1
|
require 'example_helper'
|
2
2
|
|
3
|
+
class ToBool
|
4
|
+
def initialize(bool)
|
5
|
+
@bool = bool
|
6
|
+
end
|
7
|
+
def to_bool
|
8
|
+
@bool
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
3
12
|
describe "Then" do
|
4
13
|
context "empty thens with natural assertions" do
|
5
14
|
use_natural_assertions_if_supported
|
6
15
|
Then { }
|
7
16
|
end
|
17
|
+
context "thens to_bool/true will pass" do
|
18
|
+
use_natural_assertions_if_supported
|
19
|
+
Then { ToBool.new(true) }
|
20
|
+
end
|
8
21
|
end
|
@@ -17,6 +17,30 @@ describe Given::NaturalAssertion do
|
|
17
17
|
end
|
18
18
|
end
|
19
19
|
|
20
|
+
describe "passing criteria" do
|
21
|
+
context "with true" do
|
22
|
+
FauxThen { true }
|
23
|
+
Then { _gvn_block_passed?(faux_block) }
|
24
|
+
end
|
25
|
+
|
26
|
+
context "with false" do
|
27
|
+
FauxThen { false }
|
28
|
+
Then { ! _gvn_block_passed?(faux_block) }
|
29
|
+
end
|
30
|
+
|
31
|
+
context "with to_bool/true" do
|
32
|
+
Given(:res) { double(:to_bool => true) }
|
33
|
+
FauxThen { res }
|
34
|
+
Then { _gvn_block_passed?(faux_block) }
|
35
|
+
end
|
36
|
+
|
37
|
+
context "with to_bool/false" do
|
38
|
+
Given(:res) { double(:to_bool => false) }
|
39
|
+
FauxThen { res }
|
40
|
+
Then { ! _gvn_block_passed?(faux_block) }
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
20
44
|
describe "failure messages" do
|
21
45
|
let(:msg) { na.message }
|
22
46
|
Invariant { expect(msg).to match(/^FauxThen expression/) }
|
data/spec/support/faux_then.rb
CHANGED
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.3.0.beta1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jim Weirich
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-12-
|
11
|
+
date: 2013-12-17 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.3.0.beta1
|
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.3.0.beta1
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rspec
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -85,6 +85,7 @@ files:
|
|
85
85
|
- examples/integration/and_spec.rb
|
86
86
|
- examples/integration/failing/eval_subexpression_spec.rb
|
87
87
|
- examples/integration/failing/module_nesting_spec.rb
|
88
|
+
- examples/integration/failing/to_bool_returns_false.rb
|
88
89
|
- examples/integration/failing/undefined_method_spec.rb
|
89
90
|
- examples/integration/failing_messages_spec.rb
|
90
91
|
- examples/integration/focused_line_spec.rb
|
@@ -121,9 +122,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
121
122
|
version: 1.9.2
|
122
123
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
123
124
|
requirements:
|
124
|
-
- - '
|
125
|
+
- - '>'
|
125
126
|
- !ruby/object:Gem::Version
|
126
|
-
version:
|
127
|
+
version: 1.3.1
|
127
128
|
requirements: []
|
128
129
|
rubyforge_project: given
|
129
130
|
rubygems_version: 2.1.11
|