given_core 3.4.0 → 3.5.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 21590386d93b228b7693a69b72ac1a9490153176
4
- data.tar.gz: 888675be1bcf66f89099f35a227e1450569e61e5
3
+ metadata.gz: 9a6bd70c1d9815426170d605a9040ceba3993762
4
+ data.tar.gz: 59be6e8b07e64d2a60661117dbe5c6ea0ead6d04
5
5
  SHA512:
6
- metadata.gz: f715fadc107ddab08ae1ed179ab2e5a8baf289fb61ee1a8fda0a7cdb59734e3b8604b08795f8d660e048624e8eb005e87668ac79d0c1f297e93ad588a311f68a
7
- data.tar.gz: 3b4552e9a81535deb11e291a349dc71131189e6e6cecdb9e8b3e2407b1deda4023a2c172e8e4a298ad4d6cd404bda7d390ac8a3739a296bcc0ebc3df3eb5d1e0
6
+ metadata.gz: c0aae29eb0093e3e77a26d548cf08e88225e5c9ee9cef3ebd6b0d11fc10f2f7ecdf1cc54525881ca96772cbfbc528dbd11c48fc06c445112229db01e60cc9e09
7
+ data.tar.gz: 00f16bf0ecd6df899963c9b571df2d097d66e9a2eaad21a44e93ffb83d185fcd490a66d0c9f3f2e3289527380787d24c7cc18790f4be5318090346f358cc49a3
data/Gemfile.lock CHANGED
@@ -19,6 +19,7 @@ GEM
19
19
  sorcerer (1.0.2)
20
20
 
21
21
  PLATFORMS
22
+ java
22
23
  ruby
23
24
 
24
25
  DEPENDENCIES
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.4.0.
7
+ Covering rspec-given, minitest-given, and given-core, version 3.5.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.
@@ -758,11 +758,15 @@ _expect_.
758
758
 
759
759
  ### Platform Support
760
760
 
761
- Natural assertions use the Ripper library to parse the failing
762
- condition and find all the sub-expression values upon a failure.
761
+ Given uses the Ripper library to parse the source lines and failing
762
+ conditions to find all the sub-expression values upon a failure.
763
763
  Currently Ripper is not supported on Rubinius and versions of JRuby
764
- prior to JRuby-1.7.5. Natural assertions are disabled in that case.
765
- However, all other features of Given are supported.
764
+ prior to JRuby-1.7.5.
765
+
766
+ If you want to use a version of Ruby that does not support Ripper,
767
+ then natural assertions will disabled. In addition, you should also
768
+ disable source caching in the configuration (see the configuration
769
+ section below).
766
770
 
767
771
  ### Non-Spec Assertions
768
772
 
@@ -787,7 +791,7 @@ end
787
791
 
788
792
  To use the non-testing assertions, you need to require the
789
793
  'given/assertions' file and then include the
790
- <code>Given::Assertions</code> module into what ever class is using
794
+ code>Given::Assertions</code> module into what ever class is using
791
795
  the
792
796
  <code>Precondition</code>/<code>Postcondition</code>/<code>Assert</code>
793
797
  methods. The code block for these assertions should always be a
@@ -1,3 +1,5 @@
1
+ require 'ripper'
2
+ require 'sorcerer'
1
3
  require 'given/file_cache'
2
4
 
3
5
  module Given
@@ -19,23 +21,26 @@ module Given
19
21
 
20
22
  def extract_lines_from(lines, line_index)
21
23
  result = lines[line_index]
22
- if continued?(result)
23
- level = indentation_level(result)
24
- begin
25
- line_index += 1
26
- result << lines[line_index]
27
- end while indentation_level(lines[line_index]) > level
24
+ while result && incomplete?(result)
25
+ line_index += 1
26
+ result << lines[line_index]
28
27
  end
29
28
  result
30
29
  end
31
30
 
32
- def continued?(string)
33
- string =~ /(\{|do) *$/
31
+ def incomplete?(string)
32
+ ! complete_sexp?(parse(string))
34
33
  end
35
34
 
36
- def indentation_level(string)
37
- string =~ /^(\s*)\S/
38
- $1.nil? ? 1000000 : $1.size
35
+ def complete_sexp?(sexp)
36
+ Sorcerer.source(sexp)
37
+ true
38
+ rescue Sorcerer::Resource::NotSexpError => ex
39
+ false
40
+ end
41
+
42
+ def parse(string)
43
+ Ripper::SexpBuilder.new(string).parse
39
44
  end
40
45
  end
41
46
  end
data/lib/given/version.rb CHANGED
@@ -2,7 +2,7 @@
2
2
  module Given
3
3
  VERSION_NUMBERS = [
4
4
  VERSION_MAJOR = 3,
5
- VERSION_MINOR = 4,
5
+ VERSION_MINOR = 5,
6
6
  VERSION_BUILD = 0,
7
7
  ]
8
8
  VERSION = VERSION_NUMBERS.join(".")
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: given_core
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.4.0
4
+ version: 3.5.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: 2013-12-31 00:00:00.000000000 Z
11
+ date: 2014-01-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sorcerer