comfortable_mexican_sofa 1.0.16 → 1.0.17

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.0.16
1
+ 1.0.17
@@ -77,8 +77,12 @@ class CmsLayout < ActiveRecord::Base
77
77
  # is ignored.
78
78
  def merged_content
79
79
  if parent
80
- c = parent.merged_content.gsub CmsTag::PageText.regex_tag_signature('content'), content
81
- c == parent.merged_content ? content : c
80
+ regex = CmsTag::PageText.regex_tag_signature('content')
81
+ if parent.merged_content.match(regex)
82
+ parent.merged_content.gsub(regex, content)
83
+ else
84
+ content
85
+ end
82
86
  else
83
87
  content
84
88
  end
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{comfortable_mexican_sofa}
8
- s.version = "1.0.16"
8
+ s.version = "1.0.17"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Oleg Khabarov", "The Working Group Inc"]
@@ -49,15 +49,22 @@ class CmsLayoutTest < ActiveSupport::TestCase
49
49
  assert_equal ['cms_admin.html.erb'], CmsLayout.app_layouts_for_select
50
50
  end
51
51
 
52
- def test_merged_content
52
+ def test_merged_content_with_same_child_content
53
53
  parent_layout = cms_layouts(:nested)
54
- layout = cms_layouts(:child)
55
- assert_equal "{{cms:page:header}}\n{{cms:page:left_column}}\n{{cms:page:right_column}}", layout.merged_content
56
- assert_equal "{{cms:page:left_column}}\n{{cms:page:right_column}}", layout.content
54
+ assert_equal "{{cms:page:header}}\n{{cms:page:content}}", parent_layout.content
55
+ assert_equal "{{cms:page:header}}\n{{cms:page:content}}", parent_layout.merged_content
56
+
57
+ child_layout = cms_layouts(:child)
58
+ assert_equal parent_layout, child_layout.parent
59
+ assert_equal "{{cms:page:left_column}}\n{{cms:page:right_column}}", child_layout.content
60
+ assert_equal "{{cms:page:header}}\n{{cms:page:left_column}}\n{{cms:page:right_column}}", child_layout.merged_content
61
+
62
+ child_layout.update_attribute(:content, '{{cms:page:content}}')
63
+ assert_equal "{{cms:page:header}}\n{{cms:page:content}}", child_layout.merged_content
57
64
 
58
65
  parent_layout.update_attribute(:content, '{{cms:page:whatever}}')
59
- layout.reload
60
- assert_equal "{{cms:page:left_column}}\n{{cms:page:right_column}}", layout.merged_content
66
+ child_layout.reload
67
+ assert_equal '{{cms:page:content}}', child_layout.merged_content
61
68
  end
62
69
 
63
70
  def test_merged_css
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: comfortable_mexican_sofa
3
3
  version: !ruby/object:Gem::Version
4
- hash: 55
4
+ hash: 53
5
5
  prerelease: false
6
6
  segments:
7
7
  - 1
8
8
  - 0
9
- - 16
10
- version: 1.0.16
9
+ - 17
10
+ version: 1.0.17
11
11
  platform: ruby
12
12
  authors:
13
13
  - Oleg Khabarov