mongoid-filterable 0.1.0 → 0.1.1

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,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 4b18210c949bcbfb7ad280790bd2e83f42d27736
4
- data.tar.gz: f8ac9f1c9f672ff292175328977e73170214fced
3
+ metadata.gz: fde9d83b88b2d886f664e4b8f6259b211bcc8de3
4
+ data.tar.gz: e210953988bc2bf8d6312088f0d5c5242edf9f03
5
5
  SHA512:
6
- metadata.gz: a331c668aa00285c52f8d62ef46e8893c303ebe2f14930790bf56f96878150dac561d51a2458f0dba320c213c973e3e249f27ceddc5751989ae9e4c4129d96b3
7
- data.tar.gz: a2615a0671fc4c754620659f6a65e4e5f0242863ac564d08d44a4b5e873ccf9160352c4ab9b207f66d29324ecd6cd1793ba201ac5da174fc848947fb7a72fe95
6
+ metadata.gz: d785c82ca2ab77429e5c205d542e93bad551e98a5b65ef0d2bc3729a3250e245f166f4764ef6ea374a355cfd57ef94e21654734fba0f6fea0e13e34de18003f4
7
+ data.tar.gz: 5ecd66e9db4e1fdb733c36d75ddf9bb027718e4512b617f23bfb5bda63e2d0fee61df364d76dff1fc64e7a16218dbe090c615d7f9262f814239773415f11c743
@@ -8,6 +8,7 @@ module Mongoid
8
8
  # Applies params scopes to current scope
9
9
  #
10
10
  def filter(filtering_params, operator='$and')
11
+ return self unless filtering_params
11
12
  results = self.all
12
13
  selectors = []
13
14
 
@@ -1,5 +1,5 @@
1
1
  module Mongoid
2
2
  module Filterable
3
- VERSION = "0.1.0"
3
+ VERSION = "0.1.1"
4
4
  end
5
5
  end
@@ -74,4 +74,12 @@ describe Mongoid::Filterable do
74
74
  expect(City.filter({invalid: 'val'}).count).to eq(2)
75
75
  end
76
76
  end
77
+
78
+ context 'when filter params are nil' do
79
+ it 'should ignore filter' do
80
+ City.create(name: 'city1')
81
+ City.create(name: 'city2')
82
+ expect(City.filter(nil).count).to eq(2)
83
+ end
84
+ end
77
85
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mongoid-filterable
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rafael Jurado