cuke-patterns 0.1.4 → 0.1.5
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.
- data/VERSION +1 -1
- data/cuke-patterns.gemspec +1 -1
- data/features/apply_pattern_steps.rb +1 -0
- data/features/step_definitions/simple_pattern_steps.rb +1 -0
- data/features/support/env.rb +10 -0
- data/lib/cuke-patterns/rb_dsl_ext.rb +2 -2
- data/lib/cuke-patterns/rb_language_ext.rb +2 -2
- data/lib/cuke-patterns/rb_world_ext.rb +1 -1
- metadata +2 -2
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.5
|
data/cuke-patterns.gemspec
CHANGED
data/features/support/env.rb
CHANGED
@@ -2,3 +2,13 @@ $LOAD_PATH.push File.expand_path(File.join(File.dirname(__FILE__),'..','..','lib
|
|
2
2
|
|
3
3
|
require 'cuke-patterns'
|
4
4
|
|
5
|
+
class MyWorld
|
6
|
+
# This method is here to ensure we test the proper binding for applied patterns.
|
7
|
+
def assert_pony!
|
8
|
+
:bray!
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
World do
|
13
|
+
MyWorld.new
|
14
|
+
end
|
@@ -1,8 +1,8 @@
|
|
1
1
|
module CukePatterns
|
2
2
|
module RbDslExt
|
3
3
|
|
4
|
-
def apply_rb_cuke_pattern(name, string)
|
5
|
-
@rb_language.apply_rb_cuke_pattern(name, string)
|
4
|
+
def apply_rb_cuke_pattern(name, string, world)
|
5
|
+
@rb_language.apply_rb_cuke_pattern(name, string, world)
|
6
6
|
end
|
7
7
|
|
8
8
|
def register_rb_cuke_pattern(*args, &proc)
|
@@ -42,12 +42,12 @@ module CukePatterns
|
|
42
42
|
@default_cuke_pattern_generators ||= []
|
43
43
|
end
|
44
44
|
|
45
|
-
def apply_rb_cuke_pattern(name, string)
|
45
|
+
def apply_rb_cuke_pattern(name, string, world)
|
46
46
|
name = ":#{name}" if name.is_a?(Symbol)
|
47
47
|
regexp, proc = lookup_cuke_pattern(name)
|
48
48
|
match = regexp.match(string)
|
49
49
|
raise "Pattern #{regexp.to_s} does not match #{string.inspect}" unless match
|
50
|
-
return instance_exec(*match.captures, &proc) if proc
|
50
|
+
return world.instance_exec(*match.captures, &proc) if proc
|
51
51
|
return match.to_s
|
52
52
|
end
|
53
53
|
|