mongoid-report 0.2.1 → 0.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- OGJkYjhiMWNiMGU4OTYyMzM2MmJiNjY1NGJjYThlOWFhYjU1MTg0Mg==
4
+ YmRkZTE1OTMyNjYwZDI4ZTI1NjM4MjcyNDkyZTQ2NzRhMjZlMmE3Nw==
5
5
  data.tar.gz: !binary |-
6
- NDU1MGQzY2IxZWRmNjAwM2RhNjkyZTg3MDA5NDFkNmM1M2NhZjY4Nw==
6
+ NTMyNWExZjM2YTVkZWFiZDEwZWQ3ZGI2MGVkNWMzZGQ3MjA5YWVmYw==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- MmRlMGQ3MGY0NjFlMzc2ZGU5MTYzNzlhOGI3ZGIyZGUxMGYzMDNmNzJkNTY4
10
- NjUzNjNlNGRhZTRiZTE1OGYzZjFiYjU3MWEzMDUyY2ZjNjc2NzJlMmUyMmM0
11
- YjY4YzVmYzBkNGY5N2YwMDBkMTRjNzk5NjY5MjhiMGEwZjI4NzQ=
9
+ ZWJiMWI0MjViODc1OWZjYWJmN2MwMTY3OGQ4NTA0MDg5NjVjMDQxODNlZmFk
10
+ YzgwYTYwYWU3NjQyOGNhYWMwYmYwNjRhYWFmZDMyODJjNDQ0YzFmMmFlY2E0
11
+ M2U5Nzc1YmZiYWE1M2Q3ODkzZjMwN2MwZDc5ZTliOTJkMmYxMDU=
12
12
  data.tar.gz: !binary |-
13
- ZmY3ZWUxZWNhZWVlNmMzMmU0MzZmNzBhNWMwODM2ZWU4MzdmY2UxMmMyMGQ3
14
- Y2MzYzc0NTAzMjdiMWU5YWE4M2RkMDQ1MTU2OGM4Yzg4ZjhkNjllMzMzNTA0
15
- MWUxYjVkNGQ3NmFmYjJlYzA1ZGE4NjdjMjhlYTJkNTY5ZGJmN2M=
13
+ YWYyZGZjZDY1MDE3MmVmYWY1NTc5NjFhNDNmM2MyMDE1MGQyMGM1NzZlOGM0
14
+ Mzc2OTExNDFmNDI4NDcxOTk4ZjE5ZDJmM2MyNjU0NTFiYjk4NzIwZDk5NjYy
15
+ MmEwODYzMTEyNzQ3YzRjZDJmM2JhN2MyNTUxYjA0MWI1NmExMGQ=
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- mongoid-report (0.2.1)
4
+ mongoid-report (0.2.2)
5
5
  mongoid (> 3.0.1)
6
6
 
7
7
  GEM
data/README.md CHANGED
@@ -3,6 +3,8 @@
3
3
  Library for easy building aggregation report using mongodb aggregation
4
4
  framework.
5
5
 
6
+ [![Gem Version](https://badge.fury.io/rb/mongoid-report.svg)](http://badge.fury.io/rb/mongoid-report)
7
+
6
8
  [![Build Status](https://secure.travis-ci.org/oivoodoo/mongoid-report.png?branch=master)](https://travis-ci.org/oivoodoo/mongoid-report)
7
9
 
8
10
  [![Code Climate](https://codeclimate.com/badge.png)](https://codeclimate.com/github/oivoodoo/mongoid-report)
@@ -61,9 +63,7 @@ Or install it yourself as:
61
63
 
62
64
  ## Contributors
63
65
 
64
- @oivoodoo
65
-
66
- @baltazore
66
+ [@oivoodoo](http://github.com/oivoodoo) and [@baltazore](http://github.com/baltazore)
67
67
 
68
68
  ## Contributing
69
69
 
@@ -6,6 +6,9 @@ module Mongoid
6
6
 
7
7
  def do(rows)
8
8
  drop()
9
+
10
+ return if rows.empty?
11
+
9
12
  collection.insert(rows)
10
13
  end
11
14
 
@@ -1,5 +1,5 @@
1
1
  module Mongoid
2
2
  module Report
3
- VERSION = "0.2.1"
3
+ VERSION = "0.2.2"
4
4
  end
5
5
  end
@@ -3,6 +3,26 @@ require 'spec_helper'
3
3
  describe Mongoid::Report do
4
4
  let(:klass) { Model }
5
5
 
6
+ it 'should work fine for no documents to insert' do
7
+ report_klass = Class.new do
8
+ include Mongoid::Report
9
+
10
+ report 'example' do
11
+ attach_to Model do
12
+ group_by :field1
13
+ batches pool_size: 2
14
+ column :field1, :field2
15
+ end
16
+ end
17
+ end
18
+
19
+ report = report_klass.new
20
+
21
+ scoped = report.aggregate_for('example', 'models')
22
+ scoped = scoped.out('stored-report')
23
+ expect { scoped.all }.not_to raise_error
24
+ end
25
+
6
26
  it 'should merge properly results on splitted requests' do
7
27
  ########## 1. Making the first report and out to the defined collection name.
8
28
  report_klass = Class.new do
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mongoid-report
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alexandr Korsak
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-08-19 00:00:00.000000000 Z
11
+ date: 2014-11-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: mongoid