rdo-mysql 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/rdo/mysql/version.rb +1 -1
- data/rdo-mysql.gemspec +1 -1
- data/spec/mysql/type_cast_spec.rb +58 -0
- metadata +6 -6
data/lib/rdo/mysql/version.rb
CHANGED
data/rdo-mysql.gemspec
CHANGED
@@ -16,7 +16,7 @@ Gem::Specification.new do |gem|
|
|
16
16
|
gem.version = RDO::MySQL::VERSION
|
17
17
|
gem.extensions = ["ext/rdo_mysql/extconf.rb"]
|
18
18
|
|
19
|
-
gem.add_runtime_dependency "rdo", "
|
19
|
+
gem.add_runtime_dependency "rdo", "~> 0.1.0"
|
20
20
|
|
21
21
|
gem.add_development_dependency "rspec"
|
22
22
|
gem.add_development_dependency "rake-compiler"
|
@@ -103,6 +103,64 @@ describe RDO::MySQL::Driver, "type casting" do
|
|
103
103
|
end
|
104
104
|
end
|
105
105
|
|
106
|
+
describe "mediumtext cast" do
|
107
|
+
before(:each) do
|
108
|
+
connection.execute("CREATE TEMPORARY TABLE test (v MEDIUMTEXT)")
|
109
|
+
connection.execute("INSERT INTO test (v) VALUES ('bobby')")
|
110
|
+
end
|
111
|
+
|
112
|
+
let(:sql) { "SELECT v FROM test" }
|
113
|
+
|
114
|
+
it "returns a String" do
|
115
|
+
value.should == "bobby"
|
116
|
+
end
|
117
|
+
|
118
|
+
context "with utf-8 encoding" do
|
119
|
+
let(:options) { URI.parse(connection_uri).tap{|u| u.query = "encoding=utf-8"}.to_s }
|
120
|
+
|
121
|
+
it "has the correct encoding" do
|
122
|
+
value.encoding.should == Encoding.find("utf-8")
|
123
|
+
end
|
124
|
+
end
|
125
|
+
|
126
|
+
context "with iso-8859-1 encoding" do
|
127
|
+
let(:options) { URI.parse(connection_uri).tap{|u| u.query = "encoding=iso-8859-1"}.to_s }
|
128
|
+
|
129
|
+
it "has the correct encoding" do
|
130
|
+
value.encoding.should == Encoding.find("iso-8859-1")
|
131
|
+
end
|
132
|
+
end
|
133
|
+
end
|
134
|
+
|
135
|
+
describe "longtext cast" do
|
136
|
+
before(:each) do
|
137
|
+
connection.execute("CREATE TEMPORARY TABLE test (v LONGTEXT)")
|
138
|
+
connection.execute("INSERT INTO test (v) VALUES ('bobby')")
|
139
|
+
end
|
140
|
+
|
141
|
+
let(:sql) { "SELECT v FROM test" }
|
142
|
+
|
143
|
+
it "returns a String" do
|
144
|
+
value.should == "bobby"
|
145
|
+
end
|
146
|
+
|
147
|
+
context "with utf-8 encoding" do
|
148
|
+
let(:options) { URI.parse(connection_uri).tap{|u| u.query = "encoding=utf-8"}.to_s }
|
149
|
+
|
150
|
+
it "has the correct encoding" do
|
151
|
+
value.encoding.should == Encoding.find("utf-8")
|
152
|
+
end
|
153
|
+
end
|
154
|
+
|
155
|
+
context "with iso-8859-1 encoding" do
|
156
|
+
let(:options) { URI.parse(connection_uri).tap{|u| u.query = "encoding=iso-8859-1"}.to_s }
|
157
|
+
|
158
|
+
it "has the correct encoding" do
|
159
|
+
value.encoding.should == Encoding.find("iso-8859-1")
|
160
|
+
end
|
161
|
+
end
|
162
|
+
end
|
163
|
+
|
106
164
|
describe "binary cast" do
|
107
165
|
before(:each) do
|
108
166
|
connection.execute("CREATE TEMPORARY TABLE test (v BINARY(3))")
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rdo-mysql
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,24 +9,24 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-10-
|
12
|
+
date: 2012-10-11 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rdo
|
16
16
|
requirement: !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
|
-
- -
|
19
|
+
- - ~>
|
20
20
|
- !ruby/object:Gem::Version
|
21
|
-
version: 0.0
|
21
|
+
version: 0.1.0
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
24
|
version_requirements: !ruby/object:Gem::Requirement
|
25
25
|
none: false
|
26
26
|
requirements:
|
27
|
-
- -
|
27
|
+
- - ~>
|
28
28
|
- !ruby/object:Gem::Version
|
29
|
-
version: 0.0
|
29
|
+
version: 0.1.0
|
30
30
|
- !ruby/object:Gem::Dependency
|
31
31
|
name: rspec
|
32
32
|
requirement: !ruby/object:Gem::Requirement
|