mongoid-report 0.0.7 → 0.0.8

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- NWFkMjE5MjllMjY1NjY3MjYzYTdlYTMyNWVhYTlmNjVjMzI4MWRjZg==
4
+ NTc1MDVkMjAwOGQ1MTRlM2E0NWQ2ZDk4ODE4MjllZjEzZGRmYWJhMA==
5
5
  data.tar.gz: !binary |-
6
- OWEzMzBkOTRlZTUxMzZhN2E1OWExMzNjYjM4ZTViZTIzODhjMzdhNg==
6
+ ZDc5ZDViNjhhZmFkZTQ1MzBiZWYwYzVmNTVhYzUzYTM3ZDBjNGYxNg==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- ODM5YjVmMjY5ZTEzMTgzNDNkMjMyMmI3NzExZDFkOGYwMGFhMjg4ZDAxMzc1
10
- ZjBmNjhmMDczMjcxODEyY2ExMmEyZTk5YzlhZDhkODJlYmE2OGUxOWQ5ZmE5
11
- MGU5MjIwZTQxMTdjZTY4ZGQ3MjFkZWRjM2EyZjg3NjY4ZDc1NDQ=
9
+ NzZjMTZiYjc4NDJjOWRkM2VmYjg3NDYwZWUxNWY1MzNhNTg4NzFlODczYTkz
10
+ ZTdiYmEzYjUxMzNhY2Q5OWYyNTY4NTIzMjZiOTljNjI2ZWYwZDBkMmVhM2Qw
11
+ MWY1ZjBmY2YxNWI2Y2Y2ZjJlNWNjYjJiMjhmOGJmMDVkZjhlNDA=
12
12
  data.tar.gz: !binary |-
13
- ZWRmOWIwMWZkNzMwZmZjZTMxM2E5ZTg0M2IxZDcxN2U4NzYzY2Q4OWRkNDVm
14
- MTgzMmQzNWIyN2RiNTZmZDdjMGQ0YTBkOTUxY2Q0Y2U5ZTk5ZjFjYTJkZDFl
15
- MjFmZjkwYzY1MDhkM2EwNGU1NDE5ZTBjMDU1M2FmMDE4MGNjOGQ=
13
+ ODMzNGM5YmRlMzhlODVhMWI0MDE4MWEwMzdjMjkwMWI4MGJlNDU5NWY2OWJi
14
+ ODlkMTA2Y2MwMjk4YmJiNzkwMTRiNTBhN2E2Yjg4OWMwYWVjMzU0YTI3ZGFl
15
+ N2I1OTMyNjEyMDJlMjc2NzJhNTkyNTY4Yjk4NzQzZTAyMjA0MDM=
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- mongoid-report (0.0.7)
4
+ mongoid-report (0.0.8)
5
5
  mongoid (> 3.0.1)
6
6
 
7
7
  GEM
@@ -2,8 +2,8 @@ module Mongoid
2
2
  module Report
3
3
 
4
4
  Scope = Struct.new(:context, :report_name) do
5
- def query(conditions)
6
- queries.concat([conditions])
5
+ def query(conditions = {})
6
+ queries.concat([conditions]) unless conditions.empty?
7
7
  self
8
8
  end
9
9
 
@@ -1,5 +1,5 @@
1
1
  module Mongoid
2
2
  module Report
3
- VERSION = "0.0.7"
3
+ VERSION = "0.0.8"
4
4
  end
5
5
  end
@@ -62,5 +62,20 @@ describe Mongoid::Report do
62
62
  expect(rows[1]['field1']).to eq(1)
63
63
  expect(rows[1]['day']).to eq(yesterday)
64
64
  end
65
+
66
+ it 'skips empty match in query' do
67
+ klass.create(day: today , field1: 1 , field2: 2)
68
+
69
+ example = Report3.new
70
+ scope = example.aggregate_for(Model)
71
+ scope = scope.query()
72
+ scope = scope.query({})
73
+
74
+ rows = scope.all
75
+
76
+ expect(rows.size).to eq(1)
77
+ expect(rows[0]['field1']).to eq(1)
78
+ expect(rows[0]['day']).to eq(today)
79
+ end
65
80
  end
66
81
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mongoid-report
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.7
4
+ version: 0.0.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alexandr Korsak