mongoid-filterable 0.2.0 → 0.2.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 +4 -4
- data/README.md +4 -0
- data/lib/mongoid-filterable/filterable.rb +1 -1
- data/lib/mongoid-filterable/version.rb +1 -1
- data/spec/filterable_spec.rb +9 -0
- metadata +3 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1afed03de888d2a4efd38e70952e7dc9c5021969
|
4
|
+
data.tar.gz: 9e5ad498c4928cf82e67dade0b302388f8c590f7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4e995be00a0ae857130777daeab41b23dcf42cb3e8a5046a45536bed6c049546455780872f6ecf534c5acea7b30be2b0c92d193146e45d8a5c07ab0803b022d8
|
7
|
+
data.tar.gz: 7826c6b4649920c30685716627cc3368ac11b623d748cb394fb35cc3c73d247e6cb6bc99dce3d3ae4066ffcda449afa3f695c883d29203def0c8cd8eef6f4ace
|
data/README.md
CHANGED
data/spec/filterable_spec.rb
CHANGED
@@ -5,6 +5,9 @@ describe Mongoid::Filterable do
|
|
5
5
|
include Mongoid::Document
|
6
6
|
include Mongoid::Filterable
|
7
7
|
|
8
|
+
default_scope -> { where(active: true) }
|
9
|
+
|
10
|
+
field :active, type: Boolean, default: true
|
8
11
|
field :name, type: String
|
9
12
|
field :code, type: Symbol
|
10
13
|
field :people, type: Integer
|
@@ -21,6 +24,12 @@ describe Mongoid::Filterable do
|
|
21
24
|
end
|
22
25
|
|
23
26
|
context 'when use default operator' do
|
27
|
+
it 'should create correct selector' do
|
28
|
+
expect(City.filter(code: :code1).selector).to eq(
|
29
|
+
{"active" => true, "$and" => [{"code" => :code1}]}
|
30
|
+
)
|
31
|
+
end
|
32
|
+
|
24
33
|
it 'should filter by default filter' do
|
25
34
|
City.create(code: :code1)
|
26
35
|
City.create(code: :code2)
|
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.2.
|
4
|
+
version: 0.2.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
|
+
date: 2017-10-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -105,7 +105,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
105
105
|
version: '0'
|
106
106
|
requirements: []
|
107
107
|
rubyforge_project:
|
108
|
-
rubygems_version: 2.
|
108
|
+
rubygems_version: 2.5.2
|
109
109
|
signing_key:
|
110
110
|
specification_version: 4
|
111
111
|
summary: Easy way to add scopes to your models.
|
@@ -113,4 +113,3 @@ test_files:
|
|
113
113
|
- spec/filterable_spec.rb
|
114
114
|
- spec/spec_helper.rb
|
115
115
|
- spec/support/mongoid.yml
|
116
|
-
has_rdoc:
|