turnip 2.1.0 → 2.1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7d33fc5658dab981447e096b6da7db0efeed9fae
4
- data.tar.gz: a83b232810d235ec830fdcade9327e339c7dc104
3
+ metadata.gz: 4688d31baee09b9a1620f80d29a619ac86d73db9
4
+ data.tar.gz: 6c2ca9e0469398260c5f558bfb4c0a43f24a752b
5
5
  SHA512:
6
- metadata.gz: c4081ba73a394b32bd771c894203c9dad8211d29ddc20988f000a55ff20cff2c2a556ea2a280106988216b3aaf903b8c9d781194ee8b72172481326db630709b
7
- data.tar.gz: c3ccbe7bb743449eee4b75fa79502bcfe28dab9b06600b479646760cd669b6582d30d4a0022251d5a276842375045fb74f00ad231d4652abc64b9809572805af
6
+ metadata.gz: da9af90c2aa18ea9bdb22b4854fd60e64cb4652b2c247cf1701afcf2ebce10d924e96ca8bba1168d5320205e8a15d74acbf5ca071f33232968435b84254be249
7
+ data.tar.gz: 139d1bd5f7af49ca90545ec0a31c216dcdd37bfd264b0cb74a2d016713c49cf9634494c2e75177bc1a33dcdb87e02d2dd9cf3b9072ade20a61643361028944aa
@@ -64,11 +64,20 @@ module Turnip
64
64
  private
65
65
 
66
66
  def find_match(value)
67
- placeholder_matches.each do |m|
67
+ @matches.each do |m|
68
68
  result = value.scan(m.regexp)
69
69
  return m, result.flatten unless result.empty?
70
70
  end
71
- nil
71
+
72
+ #
73
+ # value is one of the following:
74
+ #
75
+ # %{Jhon Doe}
76
+ # %{"Jhon Doe"}
77
+ # %{'Jhon Doe'}
78
+ #
79
+ # In any case, it passed to the step block in the state without quotes
80
+ return @default, value.sub(/^(["'])([^\1]*)\1$/, '\2')
72
81
  end
73
82
 
74
83
  def placeholder_matches
@@ -1,3 +1,3 @@
1
1
  module Turnip
2
- VERSION = '2.1.0'
2
+ VERSION = '2.1.1'
3
3
  end
@@ -94,6 +94,21 @@ describe Turnip::Placeholder do
94
94
  expect(placeholder.apply('monkey')).to eq('kn|EY')
95
95
  expect(placeholder.apply('bar')).to eq('bar')
96
96
  end
97
+
98
+ it 'extracts captures by default placeholder and passes to the block' do
99
+ placeholder = described_class.new(:test) do
100
+ default do |v|
101
+ v
102
+ end
103
+ end
104
+
105
+ expect(placeholder.apply('John Doe')).to eq('John Doe')
106
+ expect(placeholder.apply('"John Doe"')).to eq('John Doe')
107
+ expect(placeholder.apply('\'John Doe\'')).to eq('John Doe')
108
+
109
+ expect(placeholder.apply('John \n Doe')).to eq('John \n Doe')
110
+ expect(placeholder.apply('"John \n Doe"')).to eq('John \n Doe')
111
+ end
97
112
  end
98
113
 
99
114
  describe '#regexp' do
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: turnip
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.0
4
+ version: 2.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jonas Nicklas
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-03-03 00:00:00.000000000 Z
11
+ date: 2016-06-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec
@@ -155,7 +155,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
155
155
  version: '0'
156
156
  requirements: []
157
157
  rubyforge_project: turnip
158
- rubygems_version: 2.4.5
158
+ rubygems_version: 2.5.1
159
159
  signing_key:
160
160
  specification_version: 4
161
161
  summary: Gherkin extension for RSpec