activerecord-runivedo 0.5.1 → 0.5.2

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: b623b91f13fc1a06d1ece4e1f76d99ca2bc20085
4
- data.tar.gz: 3b9d9b0a5d03235af18aef81736d853b784fa22b
3
+ metadata.gz: 2367494133de67944b01d32ea200292b0d38d060
4
+ data.tar.gz: b51ba3439a8b683f5e53d3b0eb785f8328e52eb0
5
5
  SHA512:
6
- metadata.gz: 93507d535477833177703278f535b58faf843002a575e441bec93cc0b9ba0e61a15d02d20f5d8d6990bdffb64519542c4b3dd84b8368dd18b1440e38970cb1b8
7
- data.tar.gz: b908f653d0406fee2e5049f38195d3bd5dc9093bff39205a5bec1ec66266d61f6decdc6be1115d8059f2bcbddafd3551345fea2bb3691b4d2581763210727e12
6
+ metadata.gz: 546bc34a3f98f04d18881a126cba13be5e96d831a392c0de8650e4fd75ab7dd5345717228635b7ee8a4c1c1574c923bfd2c8862ac48402ac30704226ba609260
7
+ data.tar.gz: 391f69e3015e3a4793d2770da4e782e965bcf4632d4c4d98faae7f06b571d994e88a954f9603b61cb4301ac28fcf9dedfcd452b5d5e8abe82dde308189c48ebb
@@ -4,7 +4,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
4
 
5
5
  Gem::Specification.new do |spec|
6
6
  spec.name = "activerecord-runivedo"
7
- spec.version = "0.5.1"
7
+ spec.version = "0.5.2"
8
8
  spec.authors = ["Lucas Clemente"]
9
9
  spec.email = ["lucas@univedo.com"]
10
10
  spec.summary = "ActiveRecord adapter for Univedo"
@@ -7,10 +7,6 @@ require 'runivedo'
7
7
  module ActiveRecord
8
8
  module Type
9
9
  class UUID < Type::Value
10
- def type
11
- :uuid
12
- end
13
-
14
10
  def type_cast_for_database(value)
15
11
  value.to_s
16
12
  end
@@ -88,7 +84,7 @@ module ActiveRecord
88
84
  def native_database_types #:nodoc:
89
85
  {
90
86
  :primary_key => default_primary_key_type,
91
- :string => { :name => "varchar", :limit => 255 },
87
+ :string => { :name => "varchar" },
92
88
  :text => { :name => "text" },
93
89
  :integer => { :name => "integer" },
94
90
  :float => { :name => "float" },
@@ -192,12 +188,14 @@ module ActiveRecord
192
188
 
193
189
  protected
194
190
 
195
- def _type_cast(value)
191
+ def _quote(value)
196
192
  case value
193
+ when Type::Binary::Data
194
+ "x'#{value.hex}'"
197
195
  when UUIDTools::UUID
198
- value.to_s
196
+ "'#{value.to_s}'"
199
197
  else
200
- value
198
+ super
201
199
  end
202
200
  end
203
201
  end
data/test/setup_test.rb CHANGED
@@ -21,13 +21,24 @@ class SetupTest < MiniTest::Test
21
21
  end
22
22
 
23
23
  def test_queries
24
- Dummy.create dummy_char: "foo"
24
+ Dummy.create! dummy_char: "foo"
25
25
  assert_equal "foo", Dummy.all.last.dummy_char
26
26
  end
27
27
 
28
28
  def test_queries_uuid
29
29
  uuid = UUIDTools::UUID.random_create
30
- Dummy.create dummy_uuid: uuid
30
+ Dummy.create! dummy_uuid: uuid
31
31
  assert_equal uuid, Dummy.all.last.dummy_uuid
32
32
  end
33
+
34
+ def test_update
35
+ d = Dummy.create!
36
+ d.dummy_char = "foobar"
37
+ d.save
38
+ assert_equal "foobar", Dummy.all.last.dummy_char
39
+ end
40
+
41
+ def test_binary
42
+ d = Dummy.create! dummy_blob: "\0".b
43
+ end
33
44
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: activerecord-runivedo
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.1
4
+ version: 0.5.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Lucas Clemente
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-02-20 00:00:00.000000000 Z
11
+ date: 2015-02-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: runivedo