mongoid-filterable 0.3.0 → 0.3.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: 0701464e3122f49b16a47beadfc0e01139bbb6ac
4
- data.tar.gz: e86e64747217c219cb5309b5731291484f7d5d30
3
+ metadata.gz: 87d7798ec085fc87bdc881c9b1e558ba586ca6b4
4
+ data.tar.gz: 312d99250344d91691699abf7df77da2e92c6fbe
5
5
  SHA512:
6
- metadata.gz: 4eda7b941e36e6d2524bffb4ee3e227fe1aff4f9d8c432c0b967e5359ff9450b6fda9336beead0f78ed87a0276af6e2a0fcc6b2bb52c902ca6dd258a272f1a0c
7
- data.tar.gz: 7deb45a00b151e153be0cb456b0f6f9319edd4e4d9780fe54f6141838149571d77b9ae834fc2a79cca03fff987c29b19aaa2d4bda28a2bafe4a365e25586924b
6
+ metadata.gz: 1779d49149024d0414944056fca200d6dbe09107c253f219fba32db7f1bd7e0eeb41498e1539e2a8d87f2eea159f42b5812e8980ed0bf511610d871094d11b7a
7
+ data.tar.gz: 3f105856c09b016d5805589f7f6cc551b072ad4b2d89adcd1ae83729830012f9e78256ec122b7421755c1ea0125f996f0bb26d65512aca179ff82f587b2b9073
@@ -8,7 +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
+ return all unless filtering_params
12
12
  results = all
13
13
  selectors = []
14
14
  criteria = unscoped
@@ -1,5 +1,5 @@
1
1
  module Mongoid
2
2
  module Filterable
3
- VERSION = '0.3.0'
3
+ VERSION = '0.3.1'
4
4
  end
5
5
  end
@@ -122,4 +122,14 @@ describe Mongoid::Filterable do
122
122
  expect(City.filter(people_in: [500, 100]).count).to eq(2)
123
123
  end
124
124
  end
125
+
126
+ context 'when filter is applied on a scope' do
127
+ it 'previous scope is maintained' do
128
+ City.create(name: '2', people: 100)
129
+ City.create(name: '1', people: 500)
130
+ City.create(name: '1', people: 1000)
131
+ City.create(name: '1', people: 1000)
132
+ expect(City.where(name: '2').filter(nil).count).to eq(1)
133
+ end
134
+ end
125
135
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mongoid-filterable
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rafael Jurado
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-11-16 00:00:00.000000000 Z
11
+ date: 2017-11-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler