mongoid-slug 6.0.0 → 6.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/LICENSE +20 -20
- data/README.md +361 -336
- data/lib/mongoid/slug.rb +328 -328
- data/lib/mongoid/slug/criteria.rb +107 -107
- data/lib/mongoid/slug/{index.rb → index_builder.rb} +67 -45
- data/lib/mongoid/slug/railtie.rb +9 -9
- data/lib/mongoid/slug/slug_id_strategy.rb +3 -3
- data/lib/mongoid/slug/unique_slug.rb +173 -173
- data/lib/mongoid/slug/version.rb +5 -5
- data/lib/mongoid_slug.rb +2 -2
- data/lib/tasks/mongoid_slug.rake +15 -19
- data/spec/models/alias.rb +6 -6
- data/spec/models/article.rb +9 -9
- data/spec/models/artist.rb +8 -8
- data/spec/models/artwork.rb +10 -10
- data/spec/models/author.rb +15 -15
- data/spec/models/author_polymorphic.rb +15 -15
- data/spec/models/book.rb +12 -12
- data/spec/models/book_polymorphic.rb +12 -12
- data/spec/models/caption.rb +17 -17
- data/spec/models/entity.rb +11 -11
- data/spec/models/friend.rb +7 -7
- data/spec/models/incorrect_slug_persistence.rb +9 -9
- data/spec/models/integer_id.rb +9 -9
- data/spec/models/magazine.rb +7 -7
- data/spec/models/page.rb +9 -9
- data/spec/models/page_localize.rb +9 -9
- data/spec/models/page_slug_localized.rb +9 -9
- data/spec/models/page_slug_localized_custom.rb +10 -10
- data/spec/models/page_slug_localized_history.rb +9 -9
- data/spec/models/partner.rb +7 -7
- data/spec/models/person.rb +12 -12
- data/spec/models/relationship.rb +8 -8
- data/spec/models/string_id.rb +9 -9
- data/spec/models/subject.rb +7 -7
- data/spec/models/without_slug.rb +5 -5
- data/spec/mongoid/criteria_spec.rb +207 -207
- data/spec/mongoid/index_builder_spec.rb +105 -0
- data/spec/mongoid/slug_spec.rb +1175 -1169
- data/spec/shared/indexes.rb +41 -41
- data/spec/spec_helper.rb +61 -61
- data/spec/tasks/mongoid_slug_rake_spec.rb +73 -73
- metadata +31 -32
- data/spec/mongoid/index_spec.rb +0 -33
data/spec/mongoid/index_spec.rb
DELETED
@@ -1,33 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe Mongoid::Slug::Index do
|
4
|
-
let(:scope_key) { nil }
|
5
|
-
let(:by_model_type) { false }
|
6
|
-
subject { Mongoid::Slug::Index.build_index(scope_key, by_model_type) }
|
7
|
-
|
8
|
-
context 'when scope_key is set' do
|
9
|
-
let(:scope_key) { :foo }
|
10
|
-
|
11
|
-
context 'when by_model_type is true' do
|
12
|
-
let(:by_model_type) { true }
|
13
|
-
|
14
|
-
it { is_expected.to eq [{ _slugs: 1, foo: 1, _type: 1 }, {}] }
|
15
|
-
end
|
16
|
-
|
17
|
-
context 'when by_model_type is false' do
|
18
|
-
it { is_expected.to eq [{ _slugs: 1, foo: 1 }, {}] }
|
19
|
-
end
|
20
|
-
end
|
21
|
-
|
22
|
-
context 'when scope_key is not set' do
|
23
|
-
context 'when by_model_type is true' do
|
24
|
-
let(:by_model_type) { true }
|
25
|
-
|
26
|
-
it { is_expected.to eq [{ _slugs: 1, _type: 1 }, {}] }
|
27
|
-
end
|
28
|
-
|
29
|
-
context 'when by_model_type is false' do
|
30
|
-
it { is_expected.to eq [{ _slugs: 1 }, { unique: true, sparse: true }] }
|
31
|
-
end
|
32
|
-
end
|
33
|
-
end
|