rspec-given 2.1.0.beta.4 → 2.1.0.beta.5
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +0 -4
- data/Gemfile.lock +0 -2
- data/README +164 -122
- data/README.md +76 -58
- data/README.old +80 -62
- data/Rakefile +0 -1
- data/examples/{spec_helper.rb → example_helper.rb} +4 -3
- data/examples/integration/and_spec.rb +5 -4
- data/examples/integration/focused_line_spec.rb +1 -1
- data/examples/other/line_example.rb +1 -1
- data/examples/stack/stack_spec.rb +1 -1
- data/lib/rspec/given.rb +2 -1
- data/lib/rspec/given/extensions.rb +3 -3
- data/lib/rspec/given/file_cache.rb +19 -0
- data/lib/rspec/given/line_extractor.rb +43 -0
- data/lib/rspec/given/version.rb +1 -1
- metadata +27 -11
- data/lib/rspec/given/line_cache.rb +0 -34
data/lib/rspec/given/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rspec-given
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.1.0.beta.
|
4
|
+
version: 2.1.0.beta.5
|
5
5
|
prerelease: 6
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-
|
12
|
+
date: 2012-10-20 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rspec
|
16
|
-
requirement:
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>'
|
@@ -21,10 +21,15 @@ dependencies:
|
|
21
21
|
version: 1.2.8
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements:
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ! '>'
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: 1.2.8
|
25
30
|
- !ruby/object:Gem::Dependency
|
26
31
|
name: bluecloth
|
27
|
-
requirement:
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
28
33
|
none: false
|
29
34
|
requirements:
|
30
35
|
- - ! '>='
|
@@ -32,10 +37,15 @@ dependencies:
|
|
32
37
|
version: '0'
|
33
38
|
type: :development
|
34
39
|
prerelease: false
|
35
|
-
version_requirements:
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ! '>='
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: '0'
|
36
46
|
- !ruby/object:Gem::Dependency
|
37
47
|
name: rdoc
|
38
|
-
requirement:
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
39
49
|
none: false
|
40
50
|
requirements:
|
41
51
|
- - ! '>'
|
@@ -43,7 +53,12 @@ dependencies:
|
|
43
53
|
version: 2.4.2
|
44
54
|
type: :development
|
45
55
|
prerelease: false
|
46
|
-
version_requirements:
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - ! '>'
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 2.4.2
|
47
62
|
description: ! 'Given is an RSpec extension that allows explicit definition of the
|
48
63
|
|
49
64
|
pre and post-conditions for code under test.
|
@@ -65,18 +80,19 @@ files:
|
|
65
80
|
- lib/rspec/given/configure.rb
|
66
81
|
- lib/rspec/given/extensions.rb
|
67
82
|
- lib/rspec/given/failure.rb
|
83
|
+
- lib/rspec/given/file_cache.rb
|
68
84
|
- lib/rspec/given/have_failed.rb
|
69
|
-
- lib/rspec/given/
|
85
|
+
- lib/rspec/given/line_extractor.rb
|
70
86
|
- lib/rspec/given/module_methods.rb
|
71
87
|
- lib/rspec/given/rspec1_given.rb
|
72
88
|
- lib/rspec/given/version.rb
|
73
89
|
- lib/rspec/given.rb
|
90
|
+
- examples/example_helper.rb
|
74
91
|
- examples/integration/and_spec.rb
|
75
92
|
- examples/integration/focused_line_spec.rb
|
76
93
|
- examples/integration/given_spec.rb
|
77
94
|
- examples/integration/invariant_spec.rb
|
78
95
|
- examples/other/line_example.rb
|
79
|
-
- examples/spec_helper.rb
|
80
96
|
- examples/stack/stack.rb
|
81
97
|
- examples/stack/stack_spec.rb
|
82
98
|
- examples/stack/stack_spec1.rb
|
@@ -106,7 +122,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
106
122
|
version: 1.3.1
|
107
123
|
requirements: []
|
108
124
|
rubyforge_project: given
|
109
|
-
rubygems_version: 1.8.
|
125
|
+
rubygems_version: 1.8.24
|
110
126
|
signing_key:
|
111
127
|
specification_version: 3
|
112
128
|
summary: Given/When/Then Specification Extensions for RSpec.
|
@@ -1,34 +0,0 @@
|
|
1
|
-
module RSpec
|
2
|
-
module Given
|
3
|
-
class LineCache
|
4
|
-
def initialize
|
5
|
-
@lines = {}
|
6
|
-
end
|
7
|
-
|
8
|
-
def line(file_name, line)
|
9
|
-
lines = get_lines(file_name)
|
10
|
-
extract_lines_from(lines, line-1)
|
11
|
-
end
|
12
|
-
|
13
|
-
private
|
14
|
-
|
15
|
-
def extract_lines_from(lines, index)
|
16
|
-
result = lines[index]
|
17
|
-
if result =~ /\{ *$/
|
18
|
-
result =~ /^( *)[^ ]/
|
19
|
-
leading_spaces = $1
|
20
|
-
indent = leading_spaces.size
|
21
|
-
begin
|
22
|
-
index += 1
|
23
|
-
result << lines[index]
|
24
|
-
end while lines[index] =~ /^#{leading_spaces} /
|
25
|
-
end
|
26
|
-
result
|
27
|
-
end
|
28
|
-
|
29
|
-
def get_lines(file_name)
|
30
|
-
@lines[file_name] ||= open(file_name) { |f| f.readlines }
|
31
|
-
end
|
32
|
-
end
|
33
|
-
end
|
34
|
-
end
|