mongoid-rspec 1.10.0 → 1.11.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +6 -14
- data/.gitignore +2 -0
- data/.ruby-gemset +1 -0
- data/.ruby-version +1 -0
- data/.travis.yml +8 -3
- data/lib/matchers/indexes.rb +14 -2
- data/lib/mongoid-rspec/version.rb +1 -1
- data/mongoid-rspec.gemspec +1 -1
- data/spec/models/article.rb +1 -1
- data/spec/unit/indexes_spec.rb +1 -1
- metadata +19 -18
- data/.rvmrc +0 -1
checksums.yaml
CHANGED
@@ -1,15 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
metadata.gz: !binary |-
|
9
|
-
OTY3MTg0NTgzMjQ3NTE2NTRiMzIyNWNhYjEzNWEzMDFhMGEyZDNkYjJiMGUx
|
10
|
-
ZDY5MTBmZTI3NTNhZGI1OGNkOTQwYzg1ODNkYmRiNDhkMWZlOTQ5NDE3N2E5
|
11
|
-
NzdlMWU4YjI3ZGExMjJkNDMzMGEzODcxYjczMGEzNmNlYjZmMmQ=
|
12
|
-
data.tar.gz: !binary |-
|
13
|
-
NGJiNTZjZGJmZmI4Njg4OTFlZDJkMWVmODRmMDI1NjUxMGZmYTE3ODM3YjE3
|
14
|
-
MGI1Y2U3MzA4YjA4MDZlMTg5OGQ1NjVjMThhNWJlY2NlNjkyYjE4NDExNzQ4
|
15
|
-
ODc0MWMxNmI3Yzc3NTc2MTEzNzY3YWM0YWEyN2E1MTBmZTI3ODA=
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 90683af43b99f047532aad535c6e43dd6967f95d
|
4
|
+
data.tar.gz: 6dc40541b28ba2944e2a28e1db7aac2a1d8f986f
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 4600c194356594e38e1ce975412e3a64ae740deaef458adc1f069936254bc2b85c59fffbee44ee6272197affab3a998e8bf76f4d2f62eab7715cdca68e58cb74
|
7
|
+
data.tar.gz: fbd39276f0ae7b8bf388c488df939ce343bbeaa25377b79094ff24b8593590e402549681e1290ba857d5a318d4675ca1e7ed3abe449c1cad20c4cd5b5d005350
|
data/.gitignore
CHANGED
data/.ruby-gemset
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
mongoid-rspec
|
data/.ruby-version
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
ruby-2.1.0
|
data/.travis.yml
CHANGED
@@ -2,11 +2,16 @@ language: ruby
|
|
2
2
|
rvm:
|
3
3
|
- 1.9.3
|
4
4
|
- 2.0.0
|
5
|
+
- 2.1.0
|
5
6
|
- ruby-head
|
7
|
+
- jruby-18mode
|
6
8
|
- jruby-19mode
|
7
|
-
-
|
9
|
+
- jruby-head
|
10
|
+
- rbx-2.1.1
|
11
|
+
- rbx-head
|
12
|
+
- ree
|
8
13
|
matrix:
|
9
14
|
allow_failures:
|
10
15
|
- rvm: ruby-head
|
11
|
-
- rvm: jruby-
|
12
|
-
- rvm: rbx-
|
16
|
+
- rvm: jruby-head
|
17
|
+
- rvm: rbx-head
|
data/lib/matchers/indexes.rb
CHANGED
@@ -13,13 +13,12 @@ module Mongoid
|
|
13
13
|
def matches?(klass)
|
14
14
|
@klass = klass.is_a?(Class) ? klass : klass.class
|
15
15
|
@errors = []
|
16
|
-
|
17
16
|
unless @klass.index_options[@index_fields]
|
18
17
|
@errors.push "no index for #{@index_fields}"
|
19
18
|
else
|
20
19
|
if !@options.nil? && !@options.empty?
|
21
20
|
@options.each do |option, option_value|
|
22
|
-
if @klass.index_options[@index_fields][option] != option_value
|
21
|
+
if denormalising_options(@klass.index_options[@index_fields])[option] != option_value
|
23
22
|
@errors.push "index for #{@index_fields.inspect} with options of #{@klass.index_options[@index_fields].inspect}"
|
24
23
|
end
|
25
24
|
end
|
@@ -42,6 +41,19 @@ module Mongoid
|
|
42
41
|
desc << " with options of #{@options.inspect}" if @options
|
43
42
|
desc
|
44
43
|
end
|
44
|
+
|
45
|
+
private
|
46
|
+
MAPPINGS = {
|
47
|
+
dropDups: :drop_dups
|
48
|
+
}
|
49
|
+
|
50
|
+
def denormalising_options(opts)
|
51
|
+
options = {}
|
52
|
+
opts.each_pair do |option, value|
|
53
|
+
options[MAPPINGS[option] || option] = value
|
54
|
+
end
|
55
|
+
options
|
56
|
+
end
|
45
57
|
end
|
46
58
|
|
47
59
|
def have_index_for(index_fields)
|
data/mongoid-rspec.gemspec
CHANGED
data/spec/models/article.rb
CHANGED
@@ -24,7 +24,7 @@ class Article
|
|
24
24
|
validates_length_of :title, within: 8..16
|
25
25
|
validates_length_of :content, minimum: 200
|
26
26
|
|
27
|
-
index({ title: 1 }, { unique: true, background: true })
|
27
|
+
index({ title: 1 }, { unique: true, background: true, drop_dups: true })
|
28
28
|
index({ published: 1 })
|
29
29
|
index({ 'permalink._id' => 1 })
|
30
30
|
|
data/spec/unit/indexes_spec.rb
CHANGED
@@ -3,7 +3,7 @@ require 'spec_helper'
|
|
3
3
|
describe "Indexes" do
|
4
4
|
describe Article do
|
5
5
|
it { should have_index_for(published: 1) }
|
6
|
-
it { should have_index_for(title: 1).with_options(unique: true, background: true) }
|
6
|
+
it { should have_index_for(title: 1).with_options(unique: true, background: true, drop_dups: true) }
|
7
7
|
it { should have_index_for('permalink._id' => 1) }
|
8
8
|
end
|
9
9
|
|
metadata
CHANGED
@@ -1,55 +1,55 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mongoid-rspec
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.11.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Evan Sagge
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2014-02-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '0'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- -
|
24
|
+
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: mongoid
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- -
|
31
|
+
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 3.
|
33
|
+
version: 3.1.6
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- -
|
38
|
+
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: 3.
|
40
|
+
version: 3.1.6
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: rspec
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- -
|
45
|
+
- - ">="
|
46
46
|
- !ruby/object:Gem::Version
|
47
47
|
version: '2.14'
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- -
|
52
|
+
- - ">="
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '2.14'
|
55
55
|
description: RSpec matches for Mongoid models, including association and validation
|
@@ -59,11 +59,12 @@ executables: []
|
|
59
59
|
extensions: []
|
60
60
|
extra_rdoc_files: []
|
61
61
|
files:
|
62
|
-
- .bundle/config
|
63
|
-
- .document
|
64
|
-
- .gitignore
|
65
|
-
- .
|
66
|
-
- .
|
62
|
+
- ".bundle/config"
|
63
|
+
- ".document"
|
64
|
+
- ".gitignore"
|
65
|
+
- ".ruby-gemset"
|
66
|
+
- ".ruby-version"
|
67
|
+
- ".travis.yml"
|
67
68
|
- Gemfile
|
68
69
|
- LICENSE
|
69
70
|
- README.md
|
@@ -118,17 +119,17 @@ require_paths:
|
|
118
119
|
- lib
|
119
120
|
required_ruby_version: !ruby/object:Gem::Requirement
|
120
121
|
requirements:
|
121
|
-
- -
|
122
|
+
- - ">="
|
122
123
|
- !ruby/object:Gem::Version
|
123
124
|
version: '0'
|
124
125
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
125
126
|
requirements:
|
126
|
-
- -
|
127
|
+
- - ">="
|
127
128
|
- !ruby/object:Gem::Version
|
128
129
|
version: '0'
|
129
130
|
requirements: []
|
130
131
|
rubyforge_project: mongoid-rspec
|
131
|
-
rubygems_version: 2.
|
132
|
+
rubygems_version: 2.2.2
|
132
133
|
signing_key:
|
133
134
|
specification_version: 4
|
134
135
|
summary: RSpec matchers for Mongoid
|
data/.rvmrc
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
rvm use --create 1.9.3@mongoid-rspec
|