pickle 0.5.1 → 0.5.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/History.txt +4 -0
- data/lib/pickle/session.rb +15 -18
- data/lib/pickle/session/parser.rb +11 -9
- data/lib/pickle/version.rb +1 -1
- metadata +3 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1f1e30b140a40e358ef640c8a4468900f10ddc30
|
4
|
+
data.tar.gz: 8a1a5ce613b46e0ad108a14e5c9f18aadbdce58f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9fb3b8d43dd6c71a1d77dbe4033b5cb802f798377b3815b3a907a98dfd4a603c569a558e7db36029df188709be4339a4bd725bd0cf626a98e46be994b739f076
|
7
|
+
data.tar.gz: e395427019f47d25df0385f16a0d712f5450b4198b83f0530d067dc0b944f2f02688e12fab0649ef74695a6e26388c9e6ac87ba77ce4335b91eb5c24f6486c9d
|
data/History.txt
CHANGED
data/lib/pickle/session.rb
CHANGED
@@ -1,5 +1,19 @@
|
|
1
1
|
module Pickle
|
2
2
|
module Session
|
3
|
+
module PickleParserMethods
|
4
|
+
def method_missing(method, *args, &block)
|
5
|
+
if pickle_parser.respond_to?(method)
|
6
|
+
pickle_parser.send(method, *args, &block)
|
7
|
+
else
|
8
|
+
super(method, *args, &block)
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
def respond_to?(method, include_private = false)
|
13
|
+
super(method, include_private) || pickle_parser.respond_to?(method, include_private)
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
3
17
|
class ModelNotKnownError < RuntimeError
|
4
18
|
attr_reader :name
|
5
19
|
|
@@ -27,12 +41,7 @@ module Pickle
|
|
27
41
|
|
28
42
|
protected
|
29
43
|
def proxy_to_pickle_parser(world_class)
|
30
|
-
world_class.
|
31
|
-
unless methods.include?('method_missing_with_pickle_parser')
|
32
|
-
alias_method_chain :method_missing, :pickle_parser
|
33
|
-
alias_method_chain :respond_to?, :pickle_parser
|
34
|
-
end
|
35
|
-
end
|
44
|
+
world_class.send(:prepend, PickleParserMethods)
|
36
45
|
end
|
37
46
|
end
|
38
47
|
|
@@ -153,10 +162,6 @@ module Pickle
|
|
153
162
|
end
|
154
163
|
end
|
155
164
|
|
156
|
-
def respond_to_with_pickle_parser?(method, include_private = false)
|
157
|
-
respond_to_without_pickle_parser?(method, include_private) || pickle_parser.respond_to?(method, include_private)
|
158
|
-
end
|
159
|
-
|
160
165
|
protected
|
161
166
|
def create_or_build_model(method, count, pickle_ref, fields = nil)
|
162
167
|
factory, label = *parse_model(pickle_ref)
|
@@ -171,14 +176,6 @@ module Pickle
|
|
171
176
|
end
|
172
177
|
end
|
173
178
|
|
174
|
-
def method_missing_with_pickle_parser(method, *args, &block)
|
175
|
-
if pickle_parser.respond_to?(method)
|
176
|
-
pickle_parser.send(method, *args, &block)
|
177
|
-
else
|
178
|
-
method_missing_without_pickle_parser(method, *args, &block)
|
179
|
-
end
|
180
|
-
end
|
181
|
-
|
182
179
|
def pickle_parser=(parser)
|
183
180
|
parser.session = self
|
184
181
|
@pickle_parser = parser
|
@@ -2,8 +2,18 @@ module Pickle
|
|
2
2
|
module Session
|
3
3
|
# add ability to parse model names as fields, using a session
|
4
4
|
module Parser
|
5
|
+
module ParseFieldWithModel
|
6
|
+
def parse_field(field)
|
7
|
+
if session && field =~ /^(\w+): #{capture_model}$/
|
8
|
+
{$1 => session.model!($2)}
|
9
|
+
else
|
10
|
+
super(field)
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
5
15
|
def self.included(parser_class)
|
6
|
-
parser_class.
|
16
|
+
parser_class.send(:prepend, ParseFieldWithModel)
|
7
17
|
end
|
8
18
|
|
9
19
|
attr_accessor :session
|
@@ -12,14 +22,6 @@ module Pickle
|
|
12
22
|
"(?:\\w+: (?:#{match_model}|#{match_value}))"
|
13
23
|
end
|
14
24
|
|
15
|
-
def parse_field_with_model(field)
|
16
|
-
if session && field =~ /^(\w+): #{capture_model}$/
|
17
|
-
{$1 => session.model!($2)}
|
18
|
-
else
|
19
|
-
parse_field_without_model(field)
|
20
|
-
end
|
21
|
-
end
|
22
|
-
|
23
25
|
def parse_hash(hash)
|
24
26
|
hash.inject({}) do |parsed, (key, val)|
|
25
27
|
if session && val =~ /^#{capture_model}$/
|
data/lib/pickle/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pickle
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ian White
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2017-05-09 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: cucumber
|
@@ -326,7 +326,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
326
326
|
version: 1.3.6
|
327
327
|
requirements: []
|
328
328
|
rubyforge_project: pickle
|
329
|
-
rubygems_version: 2.
|
329
|
+
rubygems_version: 2.4.8
|
330
330
|
signing_key:
|
331
331
|
specification_version: 4
|
332
332
|
summary: Easy model creation and reference in your cucumber features.
|
@@ -367,4 +367,3 @@ test_files:
|
|
367
367
|
- spec/pickle/session_spec.rb
|
368
368
|
- spec/pickle_spec.rb
|
369
369
|
- spec/spec_helper.rb
|
370
|
-
has_rdoc:
|