rom-sql 0.5.0 → 0.5.1

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: bbd3084b35810eb5773f42d14ae8c75de6d6de0f
4
- data.tar.gz: 9dfa889eed6b3005a6c6385c70bceb78aa975fe5
3
+ metadata.gz: 7899f84b60af6ef8f8e80c230905abde0ca7be65
4
+ data.tar.gz: 34e2218734e91c6dfff3f83bf90db56e90b64be8
5
5
  SHA512:
6
- metadata.gz: 9d2ac005bf0b9bd1ce789d9e34822581c66510c1861c3e5bb7d6b778bc8526ef287cfc77a3aa3e204eb5c8c2c744e88fb092417c66c3bb19d74734d022f70abb
7
- data.tar.gz: f10f50b34e35e892014a394ae54e606d42bd8f8750c3640674e09116553c5b73a5846578a02e66c15011ceed60aa8d85d8e982a6bbef0ce482be18b66b28b4e2
6
+ metadata.gz: 69fb7e9221a9fd8255fec6e41f2bf3f266b8e4d5c52c102381226c0ce09c7b3bdbb1c64e6c69f0755ee97e549eb3fe258fbfc888e574f4a6130f201fd45c9838
7
+ data.tar.gz: b6275286b6649dd026b5b9c248027579da3d5b4b3de1ea123a3a252a07df42e599265d97536ac84282fb97007fe4b0d356455b2ed201df31986daea382bb76f0
@@ -1,3 +1,15 @@
1
+ ## v0.5.1 to-be-released
2
+
3
+ ### Changed
4
+
5
+ * relations won't be finalized when table(s) is/are missing (solnic)
6
+
7
+ ### Fixed
8
+
9
+ * Wrap errors when calling commands with `[]`-syntax (kwando)
10
+
11
+ [Compare v0.5.0...v0.5.1](https://github.com/rom-rb/rom-sql/compare/v0.5.0...v0.5.1)
12
+
1
13
  ## v0.5.0 2015-05-22
2
14
 
3
15
  ### Added
@@ -17,7 +29,7 @@
17
29
  * `Commands::Update#set` has been deprecated (solnic)
18
30
  * `Commands::Update#to` has been deprecated (solnic)
19
31
 
20
- [Compare v0.4.3...0.5.0](https://github.com/rom-rb/rom-sql/compare/v0.4.2...0.5.0)
32
+ [Compare v0.4.3...v0.5.0](https://github.com/rom-rb/rom-sql/compare/v0.4.2...v0.5.0)
21
33
 
22
34
  ## v0.4.3 2015-05-17
23
35
 
@@ -13,6 +13,8 @@ module ROM
13
13
  rescue *ERROR_MAP.keys => e
14
14
  raise ERROR_MAP[e.class], e
15
15
  end
16
+
17
+ alias :[] :call
16
18
  end
17
19
  end
18
20
  end
@@ -97,6 +97,8 @@ module ROM
97
97
  #
98
98
  # @api private
99
99
  def finalize(relations, relation)
100
+ return unless relation.dataset.db.table_exists?(dataset)
101
+
100
102
  model.set_dataset(relation.dataset)
101
103
  model.dataset.naked!
102
104
 
@@ -1,5 +1,5 @@
1
1
  module ROM
2
2
  module SQL
3
- VERSION = '0.5.0'.freeze
3
+ VERSION = '0.5.1'.freeze
4
4
  end
5
5
  end
@@ -184,6 +184,13 @@ describe 'Commands / Create' do
184
184
  }.to raise_error(ROM::SQL::DatabaseError)
185
185
  end
186
186
 
187
+ it 'supports [] syntax instead of call' do
188
+ expect {
189
+ Params.attribute :bogus_field
190
+ users.try { users.create[name: 'some name', bogus_field: 23] }
191
+ }.to raise_error(ROM::SQL::DatabaseError)
192
+ end
193
+
187
194
  describe '.associates' do
188
195
  it 'sets foreign key prior execution for many tuples' do
189
196
  setup.commands(:tasks) do
@@ -59,4 +59,30 @@ describe ROM::SQL::Repository do
59
59
  end
60
60
  end
61
61
  end
62
+
63
+ context 'setting up' do
64
+ include_context 'database setup'
65
+
66
+ it 'skips settings up associations when tables are missing' do
67
+ ROM.setup(:sql, uri)
68
+
69
+ ROM.relation(:foos) do
70
+ one_to_many :bars, key: :foo_id
71
+ end
72
+
73
+ expect { ROM.finalize }.not_to raise_error
74
+ end
75
+
76
+ it 'skips finalization a relation when table is missing' do
77
+ ROM.setup(:sql, uri)
78
+
79
+ class Foos < ROM::Relation[:sql]
80
+ dataset :foos
81
+ one_to_many :bars, key: :foo_id
82
+ end
83
+
84
+ expect { ROM.finalize }.not_to raise_error
85
+ expect { Foos.model.dataset }.to raise_error(Sequel::Error, /no dataset/i)
86
+ end
87
+ end
62
88
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rom-sql
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.5.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Piotr Solnica
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-05-22 00:00:00.000000000 Z
11
+ date: 2015-05-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sequel