rasti-db 0.2.5 → 0.2.6

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: 68eec068751c890730dc3399cd37d5903ba6ec82
4
- data.tar.gz: 8fa04f6ffd482270decf4b329075f22b1effc068
3
+ metadata.gz: 9e666cc71839d82d36edfac7d7370d9f31e6d275
4
+ data.tar.gz: 80a4c04065aa81c0f2c5c3935127d15c36a1127a
5
5
  SHA512:
6
- metadata.gz: beaf88832aa2d2077fc9c9ad61383bacebf84aeb21830cc965896d97fed3ad720482acd6cfd4a98a8369c58501702cdce5cc2d7865963660dad58c5cba531733
7
- data.tar.gz: aa887838a3da061324e1f4d782f15a7fbf2ef5e327176ac7c92d7d51bec45269070cac3d24fe0a57d8d1b930569a0069a0ee036113a1f9addc4dfc56c8d59189
6
+ metadata.gz: 50fc211f54d91108ff10290deb0e7ade32cc045424c8228514fddd32c8d5fd3a64fa02e2e5fb3809db3d343f91a90ddd70d392c1eeec65cd5847c5fc5b3a9533
7
+ data.tar.gz: 8b10f98acbc07463c72bffe2e50117236d882ae3eae0442bef02f4d47124a80a4e0cb52dfb5e31151f3d3b510b21d0489300e782846084ce6b4351f8479b22be
data/.travis.yml CHANGED
@@ -1,4 +1,5 @@
1
1
  language: ruby
2
+
2
3
  rvm:
3
4
  - 1.9.3
4
5
  - 2.0
@@ -6,6 +7,16 @@ rvm:
6
7
  - 2.2
7
8
  - 2.3.0
8
9
  - 2.4.0
9
- - jruby
10
+ - jruby-1.7.25
11
+ - jruby-9.1.7.0
12
+ - ruby-head
13
+ - jruby-head
14
+
15
+ matrix:
16
+ fast_finish: true
17
+ allow_failures:
18
+ - rvm: ruby-head
19
+ - rvm: jruby-head
20
+
10
21
  before_install:
11
22
  - gem install bundler
@@ -5,6 +5,7 @@ module Rasti
5
5
  CONVERTIONS = {
6
6
  postgres: {
7
7
  /^json$/ => ->(value, match) { Sequel.pg_json value },
8
+ /^jsonb$/ => ->(value, match) { Sequel.pg_jsonb value },
8
9
  /^hstore$/ => ->(value, match) { Sequel.hstore value },
9
10
  /^hstore\[\]$/ => ->(value, match) { Sequel.pg_array value.map { |v| Sequel.hstore v }, 'hstore' },
10
11
  /^([a-z]+)\[\]$/ => ->(value, match) { Sequel.pg_array value, match.captures[0] }
@@ -1,5 +1,5 @@
1
1
  module Rasti
2
2
  module DB
3
- VERSION = '0.2.5'
3
+ VERSION = '0.2.6'
4
4
  end
5
5
  end
@@ -277,10 +277,10 @@ describe 'Collection' do
277
277
  1.upto(10) { |i| db[:users].insert name: "User #{i}" }
278
278
 
279
279
  users.detect(id: 1).must_equal User.new(id: 1, name: 'User 1')
280
- users.detect(id: 0).must_equal nil
280
+ users.detect(id: 0).must_be_nil
281
281
 
282
282
  users.detect { where id: 1 }.must_equal User.new(id: 1, name: 'User 1')
283
- users.detect { where id: 0 }.must_equal nil
283
+ users.detect { where id: 0 }.must_be_nil
284
284
  end
285
285
 
286
286
  it 'Chained query' do
@@ -21,7 +21,8 @@ describe 'Type Converter' do
21
21
  [:text_array, {db_type: 'text[]'}],
22
22
  [:integer_array, {db_type: 'integer[]'}],
23
23
  [:hstore_array, {db_type: 'hstore[]'}],
24
- [:json, {db_type: 'json'}]
24
+ [:json, {db_type: 'json'}],
25
+ [:jsonb, {db_type: 'jsonb'}]
25
26
  ]
26
27
  end
27
28
  end
@@ -93,6 +94,13 @@ describe 'Type Converter' do
93
94
  attributes[:json].must_equal [{key_1: {key_2: [3]}}]
94
95
  end
95
96
 
97
+ it 'Json binary' do
98
+ attributes = type_converter.apply_to jsonb: {key_1: {key_2: [3]}}
99
+
100
+ attributes[:jsonb].class.must_equal Sequel::Postgres::JSONBHash
101
+ attributes[:jsonb].must_equal key_1: {key_2: [3]}
102
+ end
103
+
96
104
  end
97
105
 
98
106
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rasti-db
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.5
4
+ version: 0.2.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gabriel Naiman
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-09-26 00:00:00.000000000 Z
11
+ date: 2017-10-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sequel