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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 1d5e73181cf61bc93071d7161a925ed327343dc9
4
- data.tar.gz: 608ea8d31f28616d28f82724eb687c67b0f31d88
3
+ metadata.gz: d156c4796f99c95fcc27cb5de2bdad78fc15c352
4
+ data.tar.gz: a4ceb011c6bb885096f167a55f4a6bea5c5759a6
5
5
  SHA512:
6
- metadata.gz: 91305932206df20bc225b9e4c81ba5147c24ba288b687055bdc2265a7e8eba4e4085c39e37e0fb326b98274ceb6cb5ae69446bae063201dca032fe9fb5761749
7
- data.tar.gz: 111ba753e7988ba157c844da3d3628713b3b13ec2567c25089bc890946c8eb91b90c35b3c505dbe9c8177f7484dc6783502b4ffef7e270217c854f158a09f6e0
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.2.0.
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 disabled by default. To globally configure
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
 
@@ -1,5 +1,4 @@
1
1
  require 'rspec/given'
2
- require 'rspec/given/natural_assertion'
3
2
 
4
3
  describe "Natural Assertions" do
5
4
  use_natural_assertions
@@ -0,0 +1,12 @@
1
+ require 'rspec/given'
2
+
3
+ class ToBool
4
+ def to_bool
5
+ false
6
+ end
7
+ end
8
+
9
+ describe "Then with nesting" do
10
+ use_natural_assertions
11
+ Then { ToBool.new }
12
+ end
@@ -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/) }
@@ -31,6 +31,10 @@ module Faux
31
31
  end
32
32
 
33
33
  module IX
34
+ def faux_block
35
+ self.class.the_block
36
+ end
37
+
34
38
  def block_result
35
39
  instance_eval(&self.class.the_block)
36
40
  end
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.2.0
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-13 00:00:00.000000000 Z
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.2.0
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.2.0
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: '0'
127
+ version: 1.3.1
127
128
  requirements: []
128
129
  rubyforge_project: given
129
130
  rubygems_version: 2.1.11