mongoid_acts_as_page 0.5.1 → 0.5.2

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: c4951dba5a266749b7d32606a9debb898a925b98
4
- data.tar.gz: 9c3a62b90b33bf73c5c88ab7cf2e1394d21720bd
3
+ metadata.gz: 84a378af763c8a6640996c70be1ece069461ac20
4
+ data.tar.gz: 098f6cb8953afcabd4aac10c0408a5d50539e3eb
5
5
  SHA512:
6
- metadata.gz: daa8ef209e540f4683dae4d53ac28fe6cd8e89533afbcc1c5254fd0d504b08a47971a9ff5bcbbe6d44fdb51f907c7e24a8b4cbef3f88764f07449a6c0cd92d0b
7
- data.tar.gz: 800de3cf036fa072fefaa888c174703da25af21637844969883c49ea9daf999d164929840fac8e1b9a7f6cd44aa924b72c5061264ec1dbf2a5cadbd51ea6383b
6
+ metadata.gz: b82e29e2102eb626f8d4caf8ac83a8cd6c01a23d25a6d58bca5927a1a750722e7d9bf81f75ab3e6503b052905b3dd343ae6948439b312e891640cb911a4c6b63
7
+ data.tar.gz: c49febca9d363858a562671032b1e558f1876c5af239ed51b7ae6413cf1cc5678734991898538fdafa1a02beac2fca857ba171f30fe45a334d5a869419ca3a1c
data/lib/acts_as_page.rb CHANGED
@@ -8,6 +8,7 @@ module ActsAsPage
8
8
  include Mongoid::Slug
9
9
 
10
10
  field :name
11
+ field :text, default: ''
11
12
  embeds_one :seo, class_name: 'ActsAsPage::Seo', as: :page
12
13
 
13
14
  accepts_nested_attributes_for :seo
@@ -15,6 +16,8 @@ module ActsAsPage
15
16
  after_initialize do |o|
16
17
  o.build_seo(title: name) if o.seo.nil?
17
18
  end
19
+
20
+ validates :name, presence: true, uniqueness: true
18
21
  end
19
22
  end
20
23
 
@@ -1,3 +1,3 @@
1
1
  module ActsAsPage
2
- VERSION = "0.5.1"
2
+ VERSION = "0.5.2"
3
3
  end
@@ -0,0 +1,6 @@
1
+ MOPED: 127.0.0.1:27017 COMMAND database=admin command={:ismaster=>1} runtime: 41.1716ms
2
+ MOPED: 127.0.0.1:27017 QUERY database=mongoid_test collection=pages selector={"name"=>nil} flags=[] limit=-1 skip=0 batch_size=nil fields={:_id=>1} runtime: 90.3708ms
3
+ MOPED: 127.0.0.1:27017 QUERY database=mongoid_test collection=pages selector={"name"=>"new"} flags=[] limit=-1 skip=0 batch_size=nil fields={:_id=>1} runtime: 0.6724ms
4
+ MOPED: 127.0.0.1:27017 INSERT database=mongoid_test collection=pages documents=[{"_id"=>BSON::ObjectId('53b389b86d6178397d000000'), "text"=>"", "name"=>"new", "seo"=>{"_id"=>BSON::ObjectId('53b389b86d6178397d010000'), "title"=>"new", "description"=>"", "keywords"=>""}}] flags=[]
5
+ COMMAND database=mongoid_test command={:getlasterror=>1, :w=>1} runtime: 404.1425ms
6
+ MOPED: 127.0.0.1:27017 QUERY database=mongoid_test collection=pages selector={"name"=>"new"} flags=[] limit=-1 skip=0 batch_size=nil fields={:_id=>1} runtime: 73.4301ms
@@ -6,8 +6,18 @@ class Page
6
6
  end
7
7
 
8
8
 
9
- describe 'ActsAsPage' do
9
+ describe 'Page' do
10
10
  let(:page) {Page.new name: 'new'}
11
+
12
+ specify 'should name be present' do
13
+ expect((Page.new).valid?).to be_falsey
14
+ end
15
+
16
+ specify 'should name be unique' do
17
+ page.save!
18
+ expect((Page.new name: 'new').valid?).to be_falsey
19
+ end
20
+
11
21
  describe '#seo' do
12
22
  it 'return instance of class Seo' do
13
23
  expect(page.seo).to be_a(ActsAsPage::Seo)
@@ -17,4 +27,5 @@ describe 'ActsAsPage' do
17
27
  expect(page.seo.title).to eq(page.name)
18
28
  end
19
29
  end
30
+
20
31
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mongoid_acts_as_page
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.1
4
+ version: 0.5.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Max Konin