wordmove 1.0.3 → 1.0.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -43,10 +43,10 @@ module Wordmove
43
43
  def serialized_replace!(source_field, dest_field)
44
44
  length_delta = source_field.length - dest_field.length
45
45
 
46
- sql_content.gsub!(/s:(\d+):"#{Regexp.escape(source_field)}/) do |match|
46
+ sql_content.gsub!(/s:(\d+):([\\'"]+)#{Regexp.escape(source_field)}/) do |match|
47
47
  source_length = $1.to_i
48
48
  dest_length = source_length - length_delta
49
- "s:#{dest_length}:\"#{dest_field}"
49
+ "s:#{dest_length}:#{$2}#{dest_field}"
50
50
  end
51
51
  end
52
52
 
@@ -1,3 +1,3 @@
1
1
  module Wordmove
2
- VERSION = "1.0.3"
2
+ VERSION = "1.0.4"
3
3
  end
@@ -90,6 +90,15 @@ describe Wordmove::SqlMover do
90
90
  sql_mover.serialized_replace!('http://dump.com', 'http://shrubbery.com')
91
91
  sql_mover.sql_content.should == 's:4:"spam";s:25:"http://shrubbery.com/spam";s:6:"foobar";s:27:"http://shrubbery.com/foobar";s:8:"sausages"'
92
92
  end
93
+
94
+ context "given multiple types of string quoting" do
95
+ let(:content) { "s:20:\\\"http://dump.com/spam\\\";s:6:'foobar';s:22:'http://dump.com/foobar';s:8:'sausages'" }
96
+
97
+ it "handles replacing just as well" do
98
+ sql_mover.serialized_replace!('http://dump.com', 'http://shrubbery.com')
99
+ sql_mover.sql_content.should == "s:25:\\\"http://shrubbery.com/spam\\\";s:6:'foobar';s:27:'http://shrubbery.com/foobar';s:8:'sausages'"
100
+ end
101
+ end
93
102
  end
94
103
 
95
104
  context ".simple_replace!" do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: wordmove
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.3
4
+ version: 1.0.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: