diff --git a/lib/turnip/placeholder.rb b/lib/turnip/placeholder.rb index 8c47f27..3fed89f 100644 --- a/lib/turnip/placeholder.rb +++ b/lib/turnip/placeholder.rb @@ -77,7 +77,7 @@ def find_match(value) # %{'Jhon Doe'} # # In any case, it passed to the step block in the state without quotes - return @default, value.sub(/^(["'])(.*)\1$/, '\2') + return @default, value.sub(/^(["'])([^\1]*)\1$/, '\2') end def placeholder_matches diff --git a/spec/placeholder_spec.rb b/spec/placeholder_spec.rb index 49f04e0..1251adc 100644 --- a/spec/placeholder_spec.rb +++ b/spec/placeholder_spec.rb @@ -105,6 +105,9 @@ expect(placeholder.apply('John Doe')).to eq('John Doe') expect(placeholder.apply('"John Doe"')).to eq('John Doe') expect(placeholder.apply('\'John Doe\'')).to eq('John Doe') + + expect(placeholder.apply('John \n Doe')).to eq('John \n Doe') + expect(placeholder.apply('"John \n Doe"')).to eq('John \n Doe') end end