mongoid-filterable 0.0.3 → 0.1.0

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: 0cc104bbb65a8e42e77d115ebf48120f5900db83
4
- data.tar.gz: df3d3174ae73e49df358eef8184abaa4ca3eb608
3
+ metadata.gz: 4b18210c949bcbfb7ad280790bd2e83f42d27736
4
+ data.tar.gz: f8ac9f1c9f672ff292175328977e73170214fced
5
5
  SHA512:
6
- metadata.gz: 6b08758991202f1d3a837c4877e1a908a49882a045ab6f0893a905167b0fb68bf79f1c2e0d835e367554c59c8d217b75a73bd3deb6c97d1379cd2e3ab9b3446b
7
- data.tar.gz: 697ad7e99e925c6e18016b9a108be61a03b33efd8d42033f951f9273f80afb1f7c8e506a8c0a2255c8fd0a956ef087f67c34d7378fdfc2e68d7847ccc6f585e6
6
+ metadata.gz: a331c668aa00285c52f8d62ef46e8893c303ebe2f14930790bf56f96878150dac561d51a2458f0dba320c213c973e3e249f27ceddc5751989ae9e4c4129d96b3
7
+ data.tar.gz: a2615a0671fc4c754620659f6a65e4e5f0242863ac564d08d44a4b5e873ccf9160352c4ab9b207f66d29324ecd6cd1793ba201ac5da174fc848947fb7a72fe95
data/Gemfile CHANGED
@@ -2,3 +2,4 @@ source 'https://rubygems.org'
2
2
 
3
3
  # Specify your gem's dependencies in mongoid-normalize-strings.gemspec
4
4
  gemspec
5
+ gem 'mongoid', "~> 5.0"
@@ -12,7 +12,9 @@ module Mongoid
12
12
  selectors = []
13
13
 
14
14
  filtering_params.each do |key, value|
15
- selectors.push self.public_send("filter_with_#{key}", value).selector if value.present?
15
+ if value.present? && self.respond_to?("filter_with_#{key}")
16
+ selectors.push self.public_send("filter_with_#{key}", value).selector
17
+ end
16
18
  end
17
19
 
18
20
  results.selector = {operator => selectors} if selectors.size > 0
@@ -1,5 +1,5 @@
1
1
  module Mongoid
2
2
  module Filterable
3
- VERSION = "0.0.3"
3
+ VERSION = "0.1.0"
4
4
  end
5
5
  end
@@ -19,8 +19,7 @@ Gem::Specification.new do |spec|
19
19
  spec.require_paths = ["lib"]
20
20
 
21
21
  spec.add_development_dependency "bundler", "~> 1.5"
22
- spec.add_development_dependency "rake"
23
- spec.add_development_dependency "i18n"
24
22
  spec.add_development_dependency 'rspec'
25
- spec.add_development_dependency 'mongoid'
23
+ spec.add_dependency 'mongoid'
24
+ spec.add_dependency "i18n"
26
25
  end
@@ -66,4 +66,12 @@ describe Mongoid::Filterable do
66
66
  expect(City.filter({name: 'city1', people: '2000'}, '$or').count).to eq(1)
67
67
  end
68
68
  end
69
+
70
+ context 'when use invalid filter' do
71
+ it 'should ignore filter' do
72
+ City.create(name: 'city1')
73
+ City.create(name: 'city2')
74
+ expect(City.filter({invalid: 'val'}).count).to eq(2)
75
+ end
76
+ end
69
77
  end
data/spec/spec_helper.rb CHANGED
@@ -1,4 +1,7 @@
1
1
  require 'mongoid'
2
2
  require 'mongoid-filterable'
3
3
 
4
- Mongoid.load!("spec/support/mongoid.yml", :development)
4
+ Mongoid.load!("spec/support/mongoid.yml", :test)
5
+
6
+ Mongoid.logger.level = Logger::ERROR
7
+ Mongo::Logger.logger.level = Logger::ERROR
@@ -1,6 +1,6 @@
1
- development:
2
- sessions:
1
+ test:
2
+ clients:
3
3
  default:
4
- database: mongoid
4
+ database: filterable_test
5
5
  hosts:
6
6
  - localhost:27017
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.0.3
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rafael Jurado
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-12-29 00:00:00.000000000 Z
11
+ date: 2016-05-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -25,21 +25,7 @@ dependencies:
25
25
  - !ruby/object:Gem::Version
26
26
  version: '1.5'
27
27
  - !ruby/object:Gem::Dependency
28
- name: rake
29
- requirement: !ruby/object:Gem::Requirement
30
- requirements:
31
- - - ">="
32
- - !ruby/object:Gem::Version
33
- version: '0'
34
- type: :development
35
- prerelease: false
36
- version_requirements: !ruby/object:Gem::Requirement
37
- requirements:
38
- - - ">="
39
- - !ruby/object:Gem::Version
40
- version: '0'
41
- - !ruby/object:Gem::Dependency
42
- name: i18n
28
+ name: rspec
43
29
  requirement: !ruby/object:Gem::Requirement
44
30
  requirements:
45
31
  - - ">="
@@ -53,13 +39,13 @@ dependencies:
53
39
  - !ruby/object:Gem::Version
54
40
  version: '0'
55
41
  - !ruby/object:Gem::Dependency
56
- name: rspec
42
+ name: mongoid
57
43
  requirement: !ruby/object:Gem::Requirement
58
44
  requirements:
59
45
  - - ">="
60
46
  - !ruby/object:Gem::Version
61
47
  version: '0'
62
- type: :development
48
+ type: :runtime
63
49
  prerelease: false
64
50
  version_requirements: !ruby/object:Gem::Requirement
65
51
  requirements:
@@ -67,13 +53,13 @@ dependencies:
67
53
  - !ruby/object:Gem::Version
68
54
  version: '0'
69
55
  - !ruby/object:Gem::Dependency
70
- name: mongoid
56
+ name: i18n
71
57
  requirement: !ruby/object:Gem::Requirement
72
58
  requirements:
73
59
  - - ">="
74
60
  - !ruby/object:Gem::Version
75
61
  version: '0'
76
- type: :development
62
+ type: :runtime
77
63
  prerelease: false
78
64
  version_requirements: !ruby/object:Gem::Requirement
79
65
  requirements: