rom-sql 1.1.1 → 1.1.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: 8d5df789d515ed4a587a6e320675b552b87f656e
4
- data.tar.gz: e450e586c6bb7e47760bf3a714277aa1fafa62c4
3
+ metadata.gz: bf05af538889499fb9fc1d4cb73ca842fae74482
4
+ data.tar.gz: '07441291fd839e047161b70cb9f20c88ebb240f9'
5
5
  SHA512:
6
- metadata.gz: 271a9fb3be58c1e78bd9b1cefd4fc503924a8685519006ef5f88fc8ed08979a42acf3011a2fc4fd4d3603308de9910f2872860404d3a573bafc35c61cb7a326a
7
- data.tar.gz: 41289e5734f4350c9b268248ced4d68ecd6dd33fbc5489f6d802fcfb2736d291d00bedf7164787b7e0629e101af895ece5bf6d6b84352ca5e963b0af1ae84522
6
+ metadata.gz: 447330e1514ca0aea9127434f02f2a81792e7702155f29c9a6c534938f1f88209ebc31328ef23cd7b368972854cb9e245916162ac05c981e59533c111c59ea54
7
+ data.tar.gz: 35a04cc320ec2d246c58fddb5b95aeb3787af7f055f27395596d84cd56013572999648e514d9beeafc15b9f87d879cf29753f3cd3715a8df5e05fe44d2dc061a
data/CHANGELOG.md CHANGED
@@ -1,3 +1,11 @@
1
+ ## v1.1.2 2017-03-02
2
+
3
+ ### Fixed
4
+
5
+ * Fix grouping by a function in the block DSL (flash-gordon)
6
+
7
+ [Compare v1.1.1...v1.1.2](https://github.com/rom-rb/rom-sql/compare/v1.1.1...v1.1.2)
8
+
1
9
  ## v1.1.1 2017-03-01
2
10
 
3
11
  ### Fixed
data/LICENSE.txt CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2014 Piotr Solnica
1
+ Copyright (c) 2014-2017 Piotr Solnica
2
2
 
3
3
  MIT License
4
4
 
@@ -11,7 +11,7 @@ module ROM
11
11
  if schema.key?(meth)
12
12
  schema[meth].canonical
13
13
  else
14
- ::Sequel::VIRTUAL_ROW.__send__(meth.to_s.upcase, *args, &block)
14
+ ::Sequel::VIRTUAL_ROW.__send__(meth.to_s, *args, &block)
15
15
  end
16
16
  end
17
17
  end
@@ -1,5 +1,5 @@
1
1
  module ROM
2
2
  module SQL
3
- VERSION = '1.1.1'.freeze
3
+ VERSION = '1.1.2'.freeze
4
4
  end
5
5
  end
@@ -1,6 +1,7 @@
1
1
  RSpec.describe ROM::Relation, '#group' do
2
2
  subject(:relation) { relations[:users] }
3
3
 
4
+ let(:notes) { relations[:notes] }
4
5
  let(:tasks) { relations[:tasks] }
5
6
 
6
7
  include_context 'users and tasks'
@@ -36,6 +37,8 @@ RSpec.describe ROM::Relation, '#group' do
36
37
  end
37
38
 
38
39
  with_adapters :postgres do
40
+ include_context 'notes'
41
+
39
42
  it 'groups by provided attribute name in and attributes from a block' do
40
43
  grouped = relation.
41
44
  qualified.
@@ -44,5 +47,16 @@ RSpec.describe ROM::Relation, '#group' do
44
47
 
45
48
  expect(grouped.to_a).to eql([{ id: 1, name: 'Jane' }, { id: 2, name: 'Joe'}])
46
49
  end
50
+
51
+ it 'groups by a function' do
52
+ notes.insert user_id: 1, text: 'Foo', created_at: Time.now, updated_at: Time.now
53
+
54
+ grouped = notes
55
+ .select { [int::count(id), time::date_trunc('day', created_at).as(:date)] }
56
+ .group { date_trunc('day', created_at) }
57
+ .order(nil)
58
+
59
+ expect(grouped.to_a).to eql([ count: 1, date: Date.today.to_time ])
60
+ end
47
61
  end
48
62
  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: 1.1.1
4
+ version: 1.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Piotr Solnica
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-03-01 00:00:00.000000000 Z
11
+ date: 2017-03-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sequel
@@ -345,7 +345,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
345
345
  version: '0'
346
346
  requirements: []
347
347
  rubyforge_project:
348
- rubygems_version: 2.6.9
348
+ rubygems_version: 2.5.2
349
349
  signing_key:
350
350
  specification_version: 4
351
351
  summary: SQL databases support for ROM