noodall-core 0.5.0 → 0.5.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.
- data/VERSION +1 -1
- data/lib/noodall/indexer.rb +0 -1
- data/lib/noodall/node.rb +1 -2
- data/noodall-core.gemspec +2 -2
- data/spec/node_spec.rb +27 -0
- metadata +4 -4
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.5.
|
1
|
+
0.5.1
|
data/lib/noodall/indexer.rb
CHANGED
data/lib/noodall/node.rb
CHANGED
@@ -38,7 +38,7 @@ module Noodall
|
|
38
38
|
# if there are any children that are not of an allowed template, error
|
39
39
|
validates_true_for :template,
|
40
40
|
:message => "cannot be changed as sub content is not allowed in this template",
|
41
|
-
:logic => lambda { children.empty?
|
41
|
+
:logic => lambda { !_type_changed? or children.empty? or children.select{|c| !self._type.constantize.template_classes.include?(c.class)}.empty? }
|
42
42
|
|
43
43
|
scope :published, lambda { where(:published_at => { :$lte => current_time }, :published_to => { :$gte => current_time }) }
|
44
44
|
|
@@ -214,7 +214,6 @@ module Noodall
|
|
214
214
|
|
215
215
|
index = key[/#{slot_type}_slot_(\d+)$/, 1].to_i
|
216
216
|
|
217
|
-
logger.debug "Deleting #{key} #{self.send(key).inspect}" if index >= slot_count
|
218
217
|
# set the slot to nil
|
219
218
|
write_attribute(key.to_sym, nil) if index >= slot_count
|
220
219
|
end
|
data/noodall-core.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{noodall-core}
|
8
|
-
s.version = "0.5.
|
8
|
+
s.version = "0.5.1"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Steve England"]
|
12
|
-
s.date = %q{2011-02-
|
12
|
+
s.date = %q{2011-02-03}
|
13
13
|
s.description = %q{Core data objects for Noodall}
|
14
14
|
s.email = %q{steve@wearebeef.co.uk}
|
15
15
|
s.extra_rdoc_files = [
|
data/spec/node_spec.rb
CHANGED
@@ -422,4 +422,31 @@ describe Noodall::Node do
|
|
422
422
|
Noodall::Node.collection.index_information.keys.should include('dude_1')
|
423
423
|
end
|
424
424
|
|
425
|
+
describe "when template changing" do
|
426
|
+
|
427
|
+
before(:each) do
|
428
|
+
class LandingPage < Noodall::Node
|
429
|
+
root_template!
|
430
|
+
sub_templates Page, LandingPage
|
431
|
+
end
|
432
|
+
class Article < Noodall::Node
|
433
|
+
end
|
434
|
+
@page = Factory(:page)
|
435
|
+
Factory(:page, :parent => @page) # add a child
|
436
|
+
end
|
437
|
+
|
438
|
+
it "should not error if we haven't changed template" do
|
439
|
+
@page.save!
|
440
|
+
end
|
441
|
+
|
442
|
+
it "should throw an validation error if the children are not valid" do
|
443
|
+
@page.template = 'Article'
|
444
|
+
@page.save.should be(false)
|
445
|
+
end
|
446
|
+
|
447
|
+
it "should allow us to change template" do
|
448
|
+
@page.template = 'Landing Page'
|
449
|
+
@page.save!
|
450
|
+
end
|
451
|
+
end
|
425
452
|
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: noodall-core
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 9
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 5
|
9
|
-
-
|
10
|
-
version: 0.5.
|
9
|
+
- 1
|
10
|
+
version: 0.5.1
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Steve England
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-02-
|
18
|
+
date: 2011-02-03 00:00:00 +00:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|