given_core 3.4.0 → 3.5.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 +1 -0
- data/README.md +10 -6
- data/lib/given/line_extractor.rb +16 -11
- data/lib/given/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9a6bd70c1d9815426170d605a9040ceba3993762
|
4
|
+
data.tar.gz: 59be6e8b07e64d2a60661117dbe5c6ea0ead6d04
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c0aae29eb0093e3e77a26d548cf08e88225e5c9ee9cef3ebd6b0d11fc10f2f7ecdf1cc54525881ca96772cbfbc528dbd11c48fc06c445112229db01e60cc9e09
|
7
|
+
data.tar.gz: 00f16bf0ecd6df899963c9b571df2d097d66e9a2eaad21a44e93ffb83d185fcd490a66d0c9f3f2e3289527380787d24c7cc18790f4be5318090346f358cc49a3
|
data/Gemfile.lock
CHANGED
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.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
|
-
|
762
|
-
|
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.
|
765
|
-
|
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
|
-
|
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
|
data/lib/given/line_extractor.rb
CHANGED
@@ -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
|
-
|
23
|
-
|
24
|
-
|
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
|
33
|
-
|
31
|
+
def incomplete?(string)
|
32
|
+
! complete_sexp?(parse(string))
|
34
33
|
end
|
35
34
|
|
36
|
-
def
|
37
|
-
|
38
|
-
|
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
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
|
+
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:
|
11
|
+
date: 2014-01-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: sorcerer
|