pg_data_encoder 0.1.3 → 0.1.4
Sign up to get free protection for your applications and to get access to all the features.
Binary file
|
Binary file
|
@@ -1,3 +1,4 @@
|
|
1
|
+
# encoding: utf-8
|
1
2
|
require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
|
2
3
|
|
3
4
|
describe "generating data" do
|
@@ -27,6 +28,20 @@ describe "generating data" do
|
|
27
28
|
str.should == existing_data
|
28
29
|
end
|
29
30
|
|
31
|
+
it 'should encode hstore with utf8 data correctly from tempfile' do
|
32
|
+
encoder = PgDataEncoder::EncodeForCopy.new(:use_tempfile => true)
|
33
|
+
encoder.add [{test: "Ekström"}]
|
34
|
+
encoder.add [{test: "Dueñas"}]
|
35
|
+
encoder.close
|
36
|
+
io = encoder.get_io
|
37
|
+
existing_data = filedata("hstore_utf8.dat")
|
38
|
+
str = io.read
|
39
|
+
io.class.name.should == "Tempfile"
|
40
|
+
str.force_encoding("ASCII-8BIT")
|
41
|
+
#File.open("spec/fixtures/output.dat", "w:ASCII-8BIT") {|out| out.write(str) }
|
42
|
+
str.should == existing_data
|
43
|
+
end
|
44
|
+
|
30
45
|
it 'should encode TrueClass data correctly' do
|
31
46
|
encoder = PgDataEncoder::EncodeForCopy.new
|
32
47
|
encoder.add [true]
|
@@ -238,4 +253,17 @@ describe "generating data" do
|
|
238
253
|
str.should == existing_data
|
239
254
|
end
|
240
255
|
|
256
|
+
|
257
|
+
it 'should encode utf8 string correctly' do
|
258
|
+
encoder = PgDataEncoder::EncodeForCopy.new
|
259
|
+
ekstrom = "Ekström"
|
260
|
+
encoder.add [ekstrom]
|
261
|
+
encoder.close
|
262
|
+
io = encoder.get_io
|
263
|
+
existing_data = filedata("utf8.dat")
|
264
|
+
str = io.read
|
265
|
+
io.class.name.should == "StringIO"
|
266
|
+
str.force_encoding("ASCII-8BIT")
|
267
|
+
str.should == existing_data
|
268
|
+
end
|
241
269
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pg_data_encoder
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.4
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2014-
|
12
|
+
date: 2014-08-07 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rspec
|
@@ -77,6 +77,7 @@ files:
|
|
77
77
|
- spec/fixtures/date2000.dat
|
78
78
|
- spec/fixtures/falseclass.dat
|
79
79
|
- spec/fixtures/float.dat
|
80
|
+
- spec/fixtures/hstore_utf8.dat
|
80
81
|
- spec/fixtures/intarray.dat
|
81
82
|
- spec/fixtures/just_an_array.dat
|
82
83
|
- spec/fixtures/just_an_array2.dat
|
@@ -84,6 +85,7 @@ files:
|
|
84
85
|
- spec/fixtures/output.dat
|
85
86
|
- spec/fixtures/timestamp.dat
|
86
87
|
- spec/fixtures/trueclass.dat
|
88
|
+
- spec/fixtures/utf8.dat
|
87
89
|
- spec/fixtures/uuid.dat
|
88
90
|
- spec/fixtures/uuid_array.dat
|
89
91
|
- spec/multiline_spec.rb
|
@@ -131,6 +133,7 @@ test_files:
|
|
131
133
|
- spec/fixtures/date2000.dat
|
132
134
|
- spec/fixtures/falseclass.dat
|
133
135
|
- spec/fixtures/float.dat
|
136
|
+
- spec/fixtures/hstore_utf8.dat
|
134
137
|
- spec/fixtures/intarray.dat
|
135
138
|
- spec/fixtures/just_an_array.dat
|
136
139
|
- spec/fixtures/just_an_array2.dat
|
@@ -138,6 +141,7 @@ test_files:
|
|
138
141
|
- spec/fixtures/output.dat
|
139
142
|
- spec/fixtures/timestamp.dat
|
140
143
|
- spec/fixtures/trueclass.dat
|
144
|
+
- spec/fixtures/utf8.dat
|
141
145
|
- spec/fixtures/uuid.dat
|
142
146
|
- spec/fixtures/uuid_array.dat
|
143
147
|
- spec/multiline_spec.rb
|