comfortable_mexican_sofa 1.5.11 → 1.6.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.travis.yml +2 -2
- data/Gemfile +1 -1
- data/VERSION +1 -1
- data/app/assets/images/comfortable_mexican_sofa/checkerboard.gif +0 -0
- data/app/assets/images/comfortable_mexican_sofa/elrte/elrte-toolbar.png +0 -0
- data/app/assets/images/comfortable_mexican_sofa/elrte/google-maps.png +0 -0
- data/app/assets/images/comfortable_mexican_sofa/elrte/iframe.png +0 -0
- data/app/assets/images/comfortable_mexican_sofa/elrte/media-director.png +0 -0
- data/app/assets/images/comfortable_mexican_sofa/elrte/media-flash.png +0 -0
- data/app/assets/images/comfortable_mexican_sofa/elrte/media-quicktime.png +0 -0
- data/app/assets/images/comfortable_mexican_sofa/elrte/media-realaudio.png +0 -0
- data/app/assets/images/comfortable_mexican_sofa/elrte/media-rutube.png +0 -0
- data/app/assets/images/comfortable_mexican_sofa/elrte/media-vimeo.png +0 -0
- data/app/assets/images/comfortable_mexican_sofa/elrte/media-winmedia.png +0 -0
- data/app/assets/images/comfortable_mexican_sofa/elrte/media-youtube.png +0 -0
- data/app/assets/images/comfortable_mexican_sofa/elrte/outline-div.png +0 -0
- data/app/assets/images/comfortable_mexican_sofa/elrte/outline-p.png +0 -0
- data/app/assets/images/comfortable_mexican_sofa/elrte/pagebreak.gif +0 -0
- data/app/assets/images/comfortable_mexican_sofa/elrte/pixel.gif +0 -0
- data/app/assets/images/comfortable_mexican_sofa/elrte/smileys/evilgrin.png +0 -0
- data/app/assets/images/comfortable_mexican_sofa/elrte/smileys/grin.png +0 -0
- data/app/assets/images/comfortable_mexican_sofa/elrte/smileys/happy.png +0 -0
- data/app/assets/images/comfortable_mexican_sofa/elrte/smileys/smile.png +0 -0
- data/app/assets/images/comfortable_mexican_sofa/elrte/smileys/surprised.png +0 -0
- data/app/assets/images/comfortable_mexican_sofa/elrte/smileys/tongue.png +0 -0
- data/app/assets/images/comfortable_mexican_sofa/elrte/smileys/unhappy.png +0 -0
- data/app/assets/images/comfortable_mexican_sofa/elrte/smileys/waii.png +0 -0
- data/app/assets/images/comfortable_mexican_sofa/elrte/smileys/wink.png +0 -0
- data/app/assets/images/comfortable_mexican_sofa/x.png +0 -0
- data/app/assets/javascripts/comfortable_mexican_sofa/application.js +28 -3
- data/app/assets/javascripts/comfortable_mexican_sofa/codemirror/codemirror.js +1 -1
- data/app/assets/javascripts/comfortable_mexican_sofa/elrte/elrte.codemirror.js +35 -0
- data/app/assets/javascripts/comfortable_mexican_sofa/elrte/elrte.js +267 -0
- data/app/assets/javascripts/comfortable_mexican_sofa/elrte/elrte.sofa_image.js +61 -0
- data/app/assets/javascripts/comfortable_mexican_sofa/elrte/elrte.sofa_link.js +58 -0
- data/app/assets/javascripts/comfortable_mexican_sofa/jquery.js +4 -18
- data/app/assets/stylesheets/comfortable_mexican_sofa/application.css +3 -0
- data/app/assets/stylesheets/comfortable_mexican_sofa/codemirror.css +6 -0
- data/app/assets/stylesheets/comfortable_mexican_sofa/content.css +0 -65
- data/app/assets/stylesheets/comfortable_mexican_sofa/dialogs.css +45 -0
- data/app/assets/stylesheets/comfortable_mexican_sofa/elrte.css +173 -0
- data/app/assets/stylesheets/comfortable_mexican_sofa/files.css +82 -0
- data/app/assets/stylesheets/comfortable_mexican_sofa/form.css +2 -2
- data/app/assets/stylesheets/comfortable_mexican_sofa/structure.css +1 -1
- data/app/assets/stylesheets/comfortable_mexican_sofa/widgets.css +14 -56
- data/app/controllers/cms_admin/categories_controller.rb +2 -2
- data/app/controllers/cms_admin/dialogs_controller.rb +13 -0
- data/app/controllers/cms_admin/files_controller.rb +4 -1
- data/app/controllers/cms_admin/revisions_controller.rb +2 -2
- data/app/controllers/cms_content_controller.rb +1 -1
- data/app/models/cms/block.rb +2 -2
- data/app/models/cms/category.rb +3 -0
- data/app/models/cms/file.rb +9 -1
- data/app/models/cms/layout.rb +2 -2
- data/app/models/cms/page.rb +7 -5
- data/app/models/cms/site.rb +10 -5
- data/app/models/cms/snippet.rb +5 -3
- data/app/views/cms_admin/categories/_form.html.erb +1 -1
- data/app/views/cms_admin/categories/_index.html.erb +2 -2
- data/app/views/cms_admin/dialogs/image.html.erb +7 -0
- data/app/views/cms_admin/dialogs/link.html.erb +5 -0
- data/app/views/cms_admin/files/_file.html.erb +17 -9
- data/app/views/cms_admin/files/_index.html.erb +8 -18
- data/app/views/cms_admin/files/create.js.erb +1 -1
- data/app/views/cms_admin/layouts/_form.html.erb +1 -1
- data/app/views/cms_admin/layouts/_index_branch.html.erb +1 -1
- data/app/views/cms_admin/pages/_form_blocks.html.erb +1 -1
- data/app/views/cms_admin/revisions/show.html.erb +1 -1
- data/app/views/cms_admin/sites/_form.html.erb +2 -1
- data/app/views/cms_admin/snippets/_form.html.erb +1 -1
- data/app/views/cms_admin/snippets/index.html.erb +1 -1
- data/app/views/layouts/cms_admin/_head.html.erb +7 -6
- data/comfortable_mexican_sofa.gemspec +46 -47
- data/config/initializers/paperclip.rb +0 -25
- data/config/locales/en.yml +6 -0
- data/config/locales/es.yml +6 -0
- data/config/routes.rb +3 -2
- data/db/migrate/01_create_cms.rb +37 -35
- data/db/migrate/upgrades/07_upgrade_to_1_6_0.rb +25 -0
- data/lib/comfortable_mexican_sofa/error.rb +4 -4
- data/lib/comfortable_mexican_sofa/extensions/is_categorized.rb +3 -1
- data/lib/comfortable_mexican_sofa/extensions/is_mirrored.rb +8 -8
- data/lib/comfortable_mexican_sofa/fixtures.rb +19 -19
- data/lib/comfortable_mexican_sofa/form_builder.rb +4 -4
- data/lib/comfortable_mexican_sofa/render_methods.rb +8 -8
- data/lib/comfortable_mexican_sofa/tag.rb +14 -13
- data/lib/comfortable_mexican_sofa/tags/asset.rb +6 -6
- data/lib/comfortable_mexican_sofa/tags/collection.rb +3 -3
- data/lib/comfortable_mexican_sofa/tags/field_datetime.rb +3 -3
- data/lib/comfortable_mexican_sofa/tags/field_integer.rb +3 -3
- data/lib/comfortable_mexican_sofa/tags/field_string.rb +3 -3
- data/lib/comfortable_mexican_sofa/tags/field_text.rb +3 -3
- data/lib/comfortable_mexican_sofa/tags/file.rb +5 -5
- data/lib/comfortable_mexican_sofa/tags/helper.rb +4 -4
- data/lib/comfortable_mexican_sofa/tags/page_datetime.rb +3 -3
- data/lib/comfortable_mexican_sofa/tags/page_file.rb +8 -6
- data/lib/comfortable_mexican_sofa/tags/page_files.rb +6 -4
- data/lib/comfortable_mexican_sofa/tags/page_integer.rb +3 -3
- data/lib/comfortable_mexican_sofa/tags/page_rich_text.rb +3 -3
- data/lib/comfortable_mexican_sofa/tags/page_string.rb +3 -3
- data/lib/comfortable_mexican_sofa/tags/page_text.rb +3 -3
- data/lib/comfortable_mexican_sofa/tags/partial.rb +4 -4
- data/lib/comfortable_mexican_sofa/tags/snippet.rb +5 -4
- data/lib/comfortable_mexican_sofa/view_methods.rb +6 -6
- data/test/fixtures/cms/blocks.yml +2 -2
- data/test/fixtures/cms/categories.yml +1 -0
- data/test/fixtures/cms/layouts.yml +3 -3
- data/test/fixtures/cms/revisions.yml +4 -4
- data/test/fixtures/cms/sites.yml +1 -0
- data/test/fixtures/cms/snippets.yml +1 -1
- data/test/fixtures/files/data.zip +0 -0
- data/test/functional/cms_admin/dialogs_controller_test.rb +24 -0
- data/test/functional/cms_admin/files_controller_test.rb +1 -1
- data/test/functional/cms_admin/layouts_controller_test.rb +7 -7
- data/test/functional/cms_admin/pages_controller_test.rb +34 -35
- data/test/functional/cms_admin/revisions_controller_test.rb +2 -2
- data/test/functional/cms_admin/sites_controller_test.rb +3 -2
- data/test/functional/cms_admin/snippets_controller_test.rb +8 -8
- data/test/functional/cms_content_controller_test.rb +10 -11
- data/test/gemfiles/{Gemfile.rails-3.0.10 → Gemfile.rails-3.0} +1 -1
- data/test/gemfiles/{Gemfile.rails-3.1.1 → Gemfile.rails-3.1} +1 -1
- data/test/integration/fixtures_test.rb +4 -4
- data/test/integration/mirrors_test.rb +1 -1
- data/test/integration/render_cms_test.rb +10 -10
- data/test/integration/sites_test.rb +3 -3
- data/test/test_helper.rb +3 -0
- data/test/unit/fixtures_test.rb +11 -11
- data/test/unit/mirrors_test.rb +25 -25
- data/test/unit/models/block_test.rb +29 -29
- data/test/unit/models/categorization_test.rb +1 -1
- data/test/unit/models/category_test.rb +2 -2
- data/test/unit/models/file_test.rb +18 -0
- data/test/unit/models/layout_test.rb +21 -18
- data/test/unit/models/page_test.rb +3 -3
- data/test/unit/models/site_test.rb +26 -17
- data/test/unit/models/snippet_test.rb +6 -6
- data/test/unit/revisions_test.rb +13 -13
- data/test/unit/tag_test.rb +39 -45
- data/test/unit/tags/asset_test.rb +1 -1
- data/test/unit/tags/collection_test.rb +12 -10
- data/test/unit/tags/field_datetime_test.rb +3 -3
- data/test/unit/tags/field_integer_test.rb +3 -3
- data/test/unit/tags/field_string_test.rb +4 -4
- data/test/unit/tags/field_text_test.rb +3 -3
- data/test/unit/tags/file_test.rb +1 -1
- data/test/unit/tags/helper_test.rb +3 -3
- data/test/unit/tags/page_datetime_test.rb +3 -3
- data/test/unit/tags/page_file_test.rb +7 -4
- data/test/unit/tags/page_files_test.rb +7 -4
- data/test/unit/tags/page_integer_test.rb +3 -3
- data/test/unit/tags/page_rich_text_test.rb +3 -3
- data/test/unit/tags/page_string_test.rb +3 -3
- data/test/unit/tags/page_text_test.rb +4 -4
- data/test/unit/tags/partial_test.rb +4 -4
- data/test/unit/tags/snippet_test.rb +3 -3
- metadata +51 -52
- data/app/assets/images/comfortable_mexican_sofa/wym_icons.png +0 -0
- data/app/assets/javascripts/comfortable_mexican_sofa/wymeditor/iframe/default/lbl-blockquote.png +0 -0
- data/app/assets/javascripts/comfortable_mexican_sofa/wymeditor/iframe/default/lbl-h1.png +0 -0
- data/app/assets/javascripts/comfortable_mexican_sofa/wymeditor/iframe/default/lbl-h2.png +0 -0
- data/app/assets/javascripts/comfortable_mexican_sofa/wymeditor/iframe/default/lbl-h3.png +0 -0
- data/app/assets/javascripts/comfortable_mexican_sofa/wymeditor/iframe/default/lbl-h4.png +0 -0
- data/app/assets/javascripts/comfortable_mexican_sofa/wymeditor/iframe/default/lbl-h5.png +0 -0
- data/app/assets/javascripts/comfortable_mexican_sofa/wymeditor/iframe/default/lbl-h6.png +0 -0
- data/app/assets/javascripts/comfortable_mexican_sofa/wymeditor/iframe/default/lbl-p.png +0 -0
- data/app/assets/javascripts/comfortable_mexican_sofa/wymeditor/iframe/default/lbl-pre.png +0 -0
- data/app/assets/javascripts/comfortable_mexican_sofa/wymeditor/iframe/default/wymiframe.css +0 -52
- data/app/assets/javascripts/comfortable_mexican_sofa/wymeditor/iframe/default/wymiframe.html +0 -26
- data/app/assets/javascripts/comfortable_mexican_sofa/wymeditor/jquery.wymeditor.cms.js +0 -342
- data/app/assets/javascripts/comfortable_mexican_sofa/wymeditor/jquery.wymeditor.embed.js +0 -19
- data/app/assets/javascripts/comfortable_mexican_sofa/wymeditor/jquery.wymeditor.pack.js +0 -1
- data/app/assets/javascripts/comfortable_mexican_sofa/wymeditor/lang/bg.js +0 -45
- data/app/assets/javascripts/comfortable_mexican_sofa/wymeditor/lang/ca.js +0 -45
- data/app/assets/javascripts/comfortable_mexican_sofa/wymeditor/lang/cs.js +0 -45
- data/app/assets/javascripts/comfortable_mexican_sofa/wymeditor/lang/cy.js +0 -45
- data/app/assets/javascripts/comfortable_mexican_sofa/wymeditor/lang/de.js +0 -45
- data/app/assets/javascripts/comfortable_mexican_sofa/wymeditor/lang/en.js +0 -45
- data/app/assets/javascripts/comfortable_mexican_sofa/wymeditor/lang/es.js +0 -45
- data/app/assets/javascripts/comfortable_mexican_sofa/wymeditor/lang/fa.js +0 -46
- data/app/assets/javascripts/comfortable_mexican_sofa/wymeditor/lang/fi.js +0 -44
- data/app/assets/javascripts/comfortable_mexican_sofa/wymeditor/lang/fr.js +0 -45
- data/app/assets/javascripts/comfortable_mexican_sofa/wymeditor/lang/gl.js +0 -45
- data/app/assets/javascripts/comfortable_mexican_sofa/wymeditor/lang/he.js +0 -45
- data/app/assets/javascripts/comfortable_mexican_sofa/wymeditor/lang/hr.js +0 -45
- data/app/assets/javascripts/comfortable_mexican_sofa/wymeditor/lang/hu.js +0 -45
- data/app/assets/javascripts/comfortable_mexican_sofa/wymeditor/lang/it.js +0 -45
- data/app/assets/javascripts/comfortable_mexican_sofa/wymeditor/lang/nb.js +0 -45
- data/app/assets/javascripts/comfortable_mexican_sofa/wymeditor/lang/nl.js +0 -45
- data/app/assets/javascripts/comfortable_mexican_sofa/wymeditor/lang/nn.js +0 -45
- data/app/assets/javascripts/comfortable_mexican_sofa/wymeditor/lang/pl.js +0 -45
- data/app/assets/javascripts/comfortable_mexican_sofa/wymeditor/lang/pt-br.js +0 -45
- data/app/assets/javascripts/comfortable_mexican_sofa/wymeditor/lang/pt.js +0 -45
- data/app/assets/javascripts/comfortable_mexican_sofa/wymeditor/lang/ru.js +0 -45
- data/app/assets/javascripts/comfortable_mexican_sofa/wymeditor/lang/sv.js +0 -45
- data/app/assets/javascripts/comfortable_mexican_sofa/wymeditor/lang/tr.js +0 -45
- data/app/assets/javascripts/comfortable_mexican_sofa/wymeditor/lang/zh_cn.js +0 -47
@@ -115,8 +115,8 @@ class CmsAdmin::RevisionsControllerTest < ActionController::TestCase
|
|
115
115
|
|
116
116
|
page.reload
|
117
117
|
assert_equal [
|
118
|
-
{ :
|
119
|
-
{ :
|
118
|
+
{ :identifier => 'default_field_text', :content => 'revision field content' },
|
119
|
+
{ :identifier => 'default_page_text', :content => 'revision page content' }
|
120
120
|
], page.blocks_attributes
|
121
121
|
end
|
122
122
|
end
|
@@ -44,8 +44,9 @@ class CmsAdmin::SitesControllerTest < ActionController::TestCase
|
|
44
44
|
def test_create
|
45
45
|
assert_difference 'Cms::Site.count' do
|
46
46
|
post :create, :site => {
|
47
|
-
:label
|
48
|
-
:
|
47
|
+
:label => 'Test Site',
|
48
|
+
:identifier => 'test-site',
|
49
|
+
:hostname => 'test.site.local'
|
49
50
|
}
|
50
51
|
assert_response :redirect
|
51
52
|
site = Cms::Site.last
|
@@ -17,7 +17,7 @@ class CmsAdmin::SnippetsControllerTest < ActionController::TestCase
|
|
17
17
|
end
|
18
18
|
|
19
19
|
def test_get_index_with_category
|
20
|
-
category =
|
20
|
+
category = cms_sites(:default).categories.create!(:label => 'Test Category', :categorized_type => 'Cms::Snippet')
|
21
21
|
category.categorizations.create!(:categorized => cms_snippets(:default))
|
22
22
|
|
23
23
|
get :index, :site_id => cms_sites(:default), :category => category.label
|
@@ -63,9 +63,9 @@ class CmsAdmin::SnippetsControllerTest < ActionController::TestCase
|
|
63
63
|
def test_create
|
64
64
|
assert_difference 'Cms::Snippet.count' do
|
65
65
|
post :create, :site_id => cms_sites(:default), :snippet => {
|
66
|
-
:label
|
67
|
-
:
|
68
|
-
:content
|
66
|
+
:label => 'Test Snippet',
|
67
|
+
:identifier => 'test-snippet',
|
68
|
+
:content => 'Test Content'
|
69
69
|
}
|
70
70
|
assert_response :redirect
|
71
71
|
snippet = Cms::Snippet.last
|
@@ -101,12 +101,12 @@ class CmsAdmin::SnippetsControllerTest < ActionController::TestCase
|
|
101
101
|
def test_update_failure
|
102
102
|
snippet = cms_snippets(:default)
|
103
103
|
put :update, :site_id => snippet.site, :id => snippet, :snippet => {
|
104
|
-
:
|
104
|
+
:identifier => ''
|
105
105
|
}
|
106
106
|
assert_response :success
|
107
107
|
assert_template :edit
|
108
108
|
snippet.reload
|
109
|
-
assert_not_equal '', snippet.
|
109
|
+
assert_not_equal '', snippet.identifier
|
110
110
|
assert_equal 'Failed to update snippet', flash[:error]
|
111
111
|
end
|
112
112
|
|
@@ -122,8 +122,8 @@ class CmsAdmin::SnippetsControllerTest < ActionController::TestCase
|
|
122
122
|
def test_reorder
|
123
123
|
snippet_one = cms_snippets(:default)
|
124
124
|
snippet_two = cms_sites(:default).snippets.create!(
|
125
|
-
:label
|
126
|
-
:
|
125
|
+
:label => 'test',
|
126
|
+
:identifier => 'test'
|
127
127
|
)
|
128
128
|
assert_equal 0, snippet_one.position
|
129
129
|
assert_equal 1, snippet_two.position
|
@@ -51,9 +51,8 @@ class CmsContentControllerTest < ActionController::TestCase
|
|
51
51
|
:layout_id => cms_layouts(:default).id,
|
52
52
|
:is_published => '1',
|
53
53
|
:blocks_attributes => [
|
54
|
-
{ :
|
55
|
-
:
|
56
|
-
:content => 'custom 404 page content' }
|
54
|
+
{ :identifier => 'default_page_text',
|
55
|
+
:content => 'custom 404 page content' }
|
57
56
|
]
|
58
57
|
)
|
59
58
|
assert_equal '/404', page.full_path
|
@@ -105,8 +104,8 @@ class CmsContentControllerTest < ActionController::TestCase
|
|
105
104
|
:layout_id => cms_layouts(:default).id,
|
106
105
|
:is_published => '1',
|
107
106
|
:blocks_attributes => [
|
108
|
-
{ :
|
109
|
-
:content
|
107
|
+
{ :identifier => 'default_page_text',
|
108
|
+
:content => 'text <%= 2 + 2 %> text' }
|
110
109
|
]
|
111
110
|
)
|
112
111
|
get :render_html, :cms_path => 'irb'
|
@@ -124,8 +123,8 @@ class CmsContentControllerTest < ActionController::TestCase
|
|
124
123
|
:layout_id => cms_layouts(:default).id,
|
125
124
|
:is_published => '1',
|
126
125
|
:blocks_attributes => [
|
127
|
-
{ :
|
128
|
-
:content
|
126
|
+
{ :identifier => 'default_page_text',
|
127
|
+
:content => 'text <%= 2 + 2 %> text' }
|
129
128
|
]
|
130
129
|
)
|
131
130
|
get :render_html, :cms_path => 'irb'
|
@@ -134,26 +133,26 @@ class CmsContentControllerTest < ActionController::TestCase
|
|
134
133
|
end
|
135
134
|
|
136
135
|
def test_render_css
|
137
|
-
get :render_css, :site_id => cms_sites(:default).id, :
|
136
|
+
get :render_css, :site_id => cms_sites(:default).id, :identifier => cms_layouts(:default).identifier
|
138
137
|
assert_response :success
|
139
138
|
assert_match %r{text\/css}, response.headers["Content-Type"]
|
140
139
|
assert_equal cms_layouts(:default).css, response.body
|
141
140
|
end
|
142
141
|
|
143
142
|
def test_render_css_not_found
|
144
|
-
get :render_css, :site_id => cms_sites(:default).id, :
|
143
|
+
get :render_css, :site_id => cms_sites(:default).id, :identifier => 'bogus'
|
145
144
|
assert_response 404
|
146
145
|
end
|
147
146
|
|
148
147
|
def test_render_js
|
149
|
-
get :render_js, :site_id => cms_sites(:default).id, :
|
148
|
+
get :render_js, :site_id => cms_sites(:default).id, :identifier => cms_layouts(:default).identifier
|
150
149
|
assert_response :success
|
151
150
|
assert_match %r{text\/javascript}, response.headers["Content-Type"]
|
152
151
|
assert_equal cms_layouts(:default).js, response.body
|
153
152
|
end
|
154
153
|
|
155
154
|
def test_render_js_not_found
|
156
|
-
get :render_js, :site_id => cms_sites(:default).id, :
|
155
|
+
get :render_js, :site_id => cms_sites(:default).id, :identifier => 'bogus'
|
157
156
|
assert_response 404
|
158
157
|
end
|
159
158
|
|
@@ -13,8 +13,8 @@ class FixturesTest < ActionDispatch::IntegrationTest
|
|
13
13
|
assert_response :success
|
14
14
|
|
15
15
|
assert_equal 'Default Page', Cms::Page.root.label
|
16
|
-
assert_equal 'Default Layout', Cms::Layout.
|
17
|
-
assert_equal 'Default Snippet', Cms::Snippet.
|
16
|
+
assert_equal 'Default Layout', Cms::Layout.find_by_identifier('default').label
|
17
|
+
assert_equal 'Default Snippet', Cms::Snippet.find_by_identifier('default').label
|
18
18
|
end
|
19
19
|
end
|
20
20
|
|
@@ -31,8 +31,8 @@ class FixturesTest < ActionDispatch::IntegrationTest
|
|
31
31
|
assert_response :success
|
32
32
|
|
33
33
|
assert_equal 'Home Fixture Page', Cms::Page.root.label
|
34
|
-
assert_equal 'Default Fixture Layout', Cms::Layout.
|
35
|
-
assert_equal 'Default Fixture Snippet', Cms::Snippet.
|
34
|
+
assert_equal 'Default Fixture Layout', Cms::Layout.find_by_identifier('default').label
|
35
|
+
assert_equal 'Default Fixture Snippet', Cms::Snippet.find_by_identifier('default').label
|
36
36
|
|
37
37
|
assert_equal "<html>\n <body>\n Home Page Fixture Content\nFixture Content for Default Snippet\n </body>\n</html>", response.body
|
38
38
|
end
|
@@ -5,7 +5,7 @@ class MirrorsTest < ActionDispatch::IntegrationTest
|
|
5
5
|
def setup
|
6
6
|
@site_a = cms_sites(:default)
|
7
7
|
@site_a.update_attribute(:is_mirrored, true)
|
8
|
-
@site_b = Cms::Site.create!(:hostname => 'test-b.host', :is_mirrored => true)
|
8
|
+
@site_b = Cms::Site.create!(:identifier => 'test_b', :hostname => 'test-b.host', :is_mirrored => true)
|
9
9
|
# making mirrors
|
10
10
|
Cms::Layout.all.each{ |l| l.save! }
|
11
11
|
Cms::Page.all.each{ |p| p.save! }
|
@@ -10,7 +10,7 @@ class RenderCmsTest < ActionDispatch::IntegrationTest
|
|
10
10
|
end
|
11
11
|
cms_layouts(:default).update_attribute(:content, '{{cms:page:content}}')
|
12
12
|
cms_pages(:child).update_attribute(:blocks_attributes, [
|
13
|
-
{ :
|
13
|
+
{ :identifier => 'content', :content => 'TestBlockContent' }
|
14
14
|
])
|
15
15
|
super
|
16
16
|
end
|
@@ -21,15 +21,15 @@ class RenderCmsTest < ActionDispatch::IntegrationTest
|
|
21
21
|
|
22
22
|
def create_site_b
|
23
23
|
site = Cms::Site.create!(
|
24
|
-
:
|
25
|
-
:hostname
|
24
|
+
:identifier => 'site-b',
|
25
|
+
:hostname => 'site-b.test')
|
26
26
|
layout = site.layouts.create!(
|
27
|
-
:
|
28
|
-
:content
|
27
|
+
:identifier => 'default',
|
28
|
+
:content => 'site-b {{cms:page:content}}')
|
29
29
|
page = site.pages.create!(
|
30
30
|
:label => 'default',
|
31
31
|
:layout => layout,
|
32
|
-
:blocks_attributes => [{ :
|
32
|
+
:blocks_attributes => [{ :identifier => 'content', :content => 'SiteBContent' }])
|
33
33
|
end
|
34
34
|
|
35
35
|
class ::RenderTestController < ApplicationController
|
@@ -57,7 +57,7 @@ class RenderCmsTest < ActionDispatch::IntegrationTest
|
|
57
57
|
when 'page_explicit_with_status'
|
58
58
|
render :cms_page => '/test-page', :status => 404
|
59
59
|
when 'page_explicit_with_site'
|
60
|
-
render :cms_page => '/', :cms_site => '
|
60
|
+
render :cms_page => '/', :cms_site => 'site-b'
|
61
61
|
else
|
62
62
|
raise 'Invalid or no param[:type] provided'
|
63
63
|
end
|
@@ -79,7 +79,7 @@ class RenderCmsTest < ActionDispatch::IntegrationTest
|
|
79
79
|
when 'layout_invalid'
|
80
80
|
render :cms_layout => 'invalid'
|
81
81
|
when 'layout_defaults_with_site'
|
82
|
-
render :cms_layout => 'default', :cms_site => '
|
82
|
+
render :cms_layout => 'default', :cms_site => 'site-b'
|
83
83
|
else
|
84
84
|
raise 'Invalid or no param[:type] provided'
|
85
85
|
end
|
@@ -155,7 +155,7 @@ class RenderCmsTest < ActionDispatch::IntegrationTest
|
|
155
155
|
get '/render-page?type=page_explicit_with_site'
|
156
156
|
assert_response :success
|
157
157
|
assert assigns(:cms_site)
|
158
|
-
assert_equal '
|
158
|
+
assert_equal 'site-b', assigns(:cms_site).identifier
|
159
159
|
assert_equal 'site-b SiteBContent', response.body
|
160
160
|
end
|
161
161
|
|
@@ -205,7 +205,7 @@ class RenderCmsTest < ActionDispatch::IntegrationTest
|
|
205
205
|
get '/render-layout?type=layout_defaults_with_site'
|
206
206
|
assert_response :success
|
207
207
|
assert assigns(:cms_site)
|
208
|
-
assert_equal '
|
208
|
+
assert_equal 'site-b', assigns(:cms_site).identifier
|
209
209
|
assert_equal 'site-b TestTemplate TestValue', response.body
|
210
210
|
end
|
211
211
|
|
@@ -28,9 +28,9 @@ class SitesTest < ActionDispatch::IntegrationTest
|
|
28
28
|
|
29
29
|
def test_get_public_page_with_sites_with_different_paths
|
30
30
|
Cms::Site.delete_all
|
31
|
-
site_a = Cms::Site.create!(:
|
32
|
-
site_b = Cms::Site.create!(:
|
33
|
-
site_c = Cms::Site.create!(:
|
31
|
+
site_a = Cms::Site.create!(:identifier => 'site-a', :hostname => 'test.host', :path => '')
|
32
|
+
site_b = Cms::Site.create!(:identifier => 'site-b', :hostname => 'test.host', :path => 'path-b')
|
33
|
+
site_c = Cms::Site.create!(:identifier => 'site-c', :hostname => 'test.host', :path => 'path-c/child')
|
34
34
|
|
35
35
|
%w(/ /path-a /path-a/child /path-c).each do |path|
|
36
36
|
get path
|
data/test/test_helper.rb
CHANGED
@@ -4,6 +4,9 @@ ENV['RAILS_ENV'] = 'test'
|
|
4
4
|
require File.expand_path('../../config/environment', __FILE__)
|
5
5
|
require 'rails/test_help'
|
6
6
|
|
7
|
+
# No need to add cache-busters in test environment
|
8
|
+
Paperclip::Attachment.default_options[:use_timestamp] = false
|
9
|
+
|
7
10
|
class ActiveSupport::TestCase
|
8
11
|
|
9
12
|
# Disabling the noise
|
data/test/unit/fixtures_test.rb
CHANGED
@@ -8,13 +8,13 @@ class FixturesTest < ActiveSupport::TestCase
|
|
8
8
|
assert_difference 'Cms::Layout.count', 2 do
|
9
9
|
ComfortableMexicanSofa::Fixtures.import_layouts('test.host', 'example.com')
|
10
10
|
|
11
|
-
assert layout = Cms::Layout.
|
11
|
+
assert layout = Cms::Layout.find_by_identifier('default')
|
12
12
|
assert_equal 'Default Fixture Layout', layout.label
|
13
13
|
assert_equal "<html>\n <body>\n {{ cms:page:content }}\n </body>\n</html>", layout.content
|
14
14
|
assert_equal 'body{color: red}', layout.css
|
15
15
|
assert_equal '// default js', layout.js
|
16
16
|
|
17
|
-
assert nested_layout = Cms::Layout.
|
17
|
+
assert nested_layout = Cms::Layout.find_by_identifier('nested')
|
18
18
|
assert_equal layout, nested_layout.parent
|
19
19
|
assert_equal 'Default Fixture Nested Layout', nested_layout.label
|
20
20
|
assert_equal "<div class='left'> {{ cms:page:left }} </div>\n<div class='right'> {{ cms:page:right }} </div>", nested_layout.content
|
@@ -47,7 +47,7 @@ class FixturesTest < ActiveSupport::TestCase
|
|
47
47
|
assert_equal 'div{float:left}', nested_layout.css
|
48
48
|
assert_equal '// nested js', nested_layout.js
|
49
49
|
|
50
|
-
assert_nil Cms::Layout.
|
50
|
+
assert_nil Cms::Layout.find_by_identifier('child')
|
51
51
|
end
|
52
52
|
end
|
53
53
|
|
@@ -66,7 +66,7 @@ class FixturesTest < ActiveSupport::TestCase
|
|
66
66
|
|
67
67
|
ComfortableMexicanSofa::Fixtures.import_layouts('test.host', 'example.com')
|
68
68
|
layout.reload
|
69
|
-
assert_equal 'default', layout.
|
69
|
+
assert_equal 'default', layout.identifier
|
70
70
|
assert_equal 'Default Layout', layout.label
|
71
71
|
assert_equal "{{cms:field:default_field_text:text}}\nlayout_content_a\n{{cms:page:default_page_text:text}}\nlayout_content_b\n{{cms:snippet:default}}\nlayout_content_c", layout.content
|
72
72
|
assert_equal 'default_css', layout.css
|
@@ -139,7 +139,7 @@ class FixturesTest < ActiveSupport::TestCase
|
|
139
139
|
assert_difference 'Cms::Snippet.count' do
|
140
140
|
ComfortableMexicanSofa::Fixtures.import_snippets('test.host', 'example.com')
|
141
141
|
assert snippet = Cms::Snippet.last
|
142
|
-
assert_equal 'default', snippet.
|
142
|
+
assert_equal 'default', snippet.identifier
|
143
143
|
assert_equal 'Default Fixture Snippet', snippet.label
|
144
144
|
assert_equal 'Fixture Content for Default Snippet', snippet.content
|
145
145
|
end
|
@@ -148,14 +148,14 @@ class FixturesTest < ActiveSupport::TestCase
|
|
148
148
|
def test_import_snippets_updating
|
149
149
|
snippet = cms_snippets(:default)
|
150
150
|
snippet.update_attribute(:updated_at, 10.years.ago)
|
151
|
-
assert_equal 'default', snippet.
|
151
|
+
assert_equal 'default', snippet.identifier
|
152
152
|
assert_equal 'Default Snippet', snippet.label
|
153
153
|
assert_equal 'default_snippet_content', snippet.content
|
154
154
|
|
155
155
|
assert_no_difference 'Cms::Snippet.count' do
|
156
156
|
ComfortableMexicanSofa::Fixtures.import_snippets('test.host', 'example.com')
|
157
157
|
snippet.reload
|
158
|
-
assert_equal 'default', snippet.
|
158
|
+
assert_equal 'default', snippet.identifier
|
159
159
|
assert_equal 'Default Fixture Snippet', snippet.label
|
160
160
|
assert_equal 'Fixture Content for Default Snippet', snippet.content
|
161
161
|
end
|
@@ -163,16 +163,16 @@ class FixturesTest < ActiveSupport::TestCase
|
|
163
163
|
|
164
164
|
def test_import_snippets_deleting
|
165
165
|
snippet = cms_snippets(:default)
|
166
|
-
snippet.update_attribute(:
|
166
|
+
snippet.update_attribute(:identifier, 'old')
|
167
167
|
|
168
168
|
assert_no_difference 'Cms::Snippet.count' do
|
169
169
|
ComfortableMexicanSofa::Fixtures.import_snippets('test.host', 'example.com')
|
170
170
|
assert snippet = Cms::Snippet.last
|
171
|
-
assert_equal 'default', snippet.
|
171
|
+
assert_equal 'default', snippet.identifier
|
172
172
|
assert_equal 'Default Fixture Snippet', snippet.label
|
173
173
|
assert_equal 'Fixture Content for Default Snippet', snippet.content
|
174
174
|
|
175
|
-
assert_nil Cms::Snippet.
|
175
|
+
assert_nil Cms::Snippet.find_by_identifier('old')
|
176
176
|
end
|
177
177
|
end
|
178
178
|
|
@@ -187,7 +187,7 @@ class FixturesTest < ActiveSupport::TestCase
|
|
187
187
|
|
188
188
|
ComfortableMexicanSofa::Fixtures.import_snippets('test.host', 'example.com')
|
189
189
|
snippet.reload
|
190
|
-
assert_equal 'default', snippet.
|
190
|
+
assert_equal 'default', snippet.identifier
|
191
191
|
assert_equal 'Default Snippet', snippet.label
|
192
192
|
assert_equal 'default_snippet_content', snippet.content
|
193
193
|
end
|
data/test/unit/mirrors_test.rb
CHANGED
@@ -4,20 +4,20 @@ class MirrorsTest < ActiveSupport::TestCase
|
|
4
4
|
|
5
5
|
def setup
|
6
6
|
Cms::Site.delete_all
|
7
|
-
@site_a = Cms::Site.create!(:
|
8
|
-
@site_b = Cms::Site.create!(:
|
7
|
+
@site_a = Cms::Site.create!(:identifier => 'site_a', :hostname => 'site-a.host', :is_mirrored => true)
|
8
|
+
@site_b = Cms::Site.create!(:identifier => 'site_b', :hostname => 'site-b.host', :is_mirrored => true)
|
9
9
|
end
|
10
10
|
|
11
11
|
def test_layout_creation
|
12
12
|
assert_difference 'Cms::Layout.count', 2 do
|
13
|
-
layout = @site_a.layouts.create!(:
|
13
|
+
layout = @site_a.layouts.create!(:identifier => 'test')
|
14
14
|
assert_equal 1, layout.mirrors.size
|
15
|
-
assert_equal 'test', layout.mirrors.first.
|
15
|
+
assert_equal 'test', layout.mirrors.first.identifier
|
16
16
|
end
|
17
17
|
end
|
18
18
|
|
19
19
|
def test_page_creation
|
20
|
-
layout = @site_a.layouts.create!(:
|
20
|
+
layout = @site_a.layouts.create!(:identifier => 'test')
|
21
21
|
|
22
22
|
assert_difference 'Cms::Page.count', 2 do
|
23
23
|
page = @site_a.pages.create!(
|
@@ -31,16 +31,16 @@ class MirrorsTest < ActiveSupport::TestCase
|
|
31
31
|
|
32
32
|
def test_snippet_creation
|
33
33
|
assert_difference 'Cms::Snippet.count', 2 do
|
34
|
-
snippet = @site_a.snippets.create(:
|
34
|
+
snippet = @site_a.snippets.create(:identifier => 'test')
|
35
35
|
assert_equal 1, snippet.mirrors.size
|
36
|
-
assert_equal 'test', snippet.mirrors.first.
|
36
|
+
assert_equal 'test', snippet.mirrors.first.identifier
|
37
37
|
end
|
38
38
|
end
|
39
39
|
|
40
40
|
def test_layout_update
|
41
|
-
layout_1a = @site_a.layouts.create!(:
|
42
|
-
layout_1b = @site_a.layouts.create!(:
|
43
|
-
layout_1c = @site_a.layouts.create!(:
|
41
|
+
layout_1a = @site_a.layouts.create!(:identifier => 'test_a')
|
42
|
+
layout_1b = @site_a.layouts.create!(:identifier => 'test_b')
|
43
|
+
layout_1c = @site_a.layouts.create!(:identifier => 'nested', :parent => layout_1a)
|
44
44
|
|
45
45
|
assert layout_2a = layout_1a.mirrors.first
|
46
46
|
assert layout_2b = layout_1b.mirrors.first
|
@@ -48,19 +48,19 @@ class MirrorsTest < ActiveSupport::TestCase
|
|
48
48
|
assert_equal layout_2a, layout_2c.parent
|
49
49
|
|
50
50
|
layout_1c.update_attributes!(
|
51
|
-
:
|
52
|
-
:parent
|
53
|
-
:content
|
51
|
+
:identifier => 'updated',
|
52
|
+
:parent => layout_1b,
|
53
|
+
:content => 'updated content'
|
54
54
|
)
|
55
55
|
layout_2c.reload
|
56
|
-
assert_equal 'updated', layout_2c.
|
56
|
+
assert_equal 'updated', layout_2c.identifier
|
57
57
|
assert_equal layout_2b, layout_2c.parent
|
58
58
|
assert_not_equal 'updated content', layout_2c
|
59
59
|
end
|
60
60
|
|
61
61
|
def test_page_update
|
62
|
-
layout_1a = @site_a.layouts.create!(:
|
63
|
-
layout_1b = @site_a.layouts.create!(:
|
62
|
+
layout_1a = @site_a.layouts.create!(:identifier => 'test_a')
|
63
|
+
layout_1b = @site_a.layouts.create!(:identifier => 'test_b')
|
64
64
|
|
65
65
|
page_1r = @site_a.pages.create!(:slug => 'root', :layout => layout_1a)
|
66
66
|
page_1a = @site_a.pages.create!(:slug => 'test_a', :layout => layout_1a)
|
@@ -84,21 +84,21 @@ class MirrorsTest < ActiveSupport::TestCase
|
|
84
84
|
end
|
85
85
|
|
86
86
|
def test_snippet_update
|
87
|
-
snippet_1 = @site_a.snippets.create(:
|
87
|
+
snippet_1 = @site_a.snippets.create(:identifier => 'test')
|
88
88
|
assert snippet_2 = snippet_1.mirrors.first
|
89
89
|
snippet_1.update_attributes!(
|
90
|
-
:
|
91
|
-
:content
|
90
|
+
:identifier => 'updated',
|
91
|
+
:content => 'updated content'
|
92
92
|
)
|
93
93
|
snippet_2.reload
|
94
|
-
assert_equal 'updated', snippet_2.
|
94
|
+
assert_equal 'updated', snippet_2.identifier
|
95
95
|
assert_not_equal 'updated content', snippet_2.content
|
96
96
|
end
|
97
97
|
|
98
98
|
def test_layout_destroy
|
99
|
-
layout_1a = @site_a.layouts.create!(:
|
100
|
-
layout_1b = @site_a.layouts.create!(:
|
101
|
-
layout_1c = @site_a.layouts.create!(:
|
99
|
+
layout_1a = @site_a.layouts.create!(:identifier => 'test_a')
|
100
|
+
layout_1b = @site_a.layouts.create!(:identifier => 'test_b')
|
101
|
+
layout_1c = @site_a.layouts.create!(:identifier => 'nested', :parent => layout_1b)
|
102
102
|
|
103
103
|
assert layout_2a = layout_1a.mirrors.first
|
104
104
|
assert layout_2b = layout_1b.mirrors.first
|
@@ -116,7 +116,7 @@ class MirrorsTest < ActiveSupport::TestCase
|
|
116
116
|
end
|
117
117
|
|
118
118
|
def test_page_destroy
|
119
|
-
layout = @site_a.layouts.create!(:
|
119
|
+
layout = @site_a.layouts.create!(:identifier => 'test')
|
120
120
|
page_1r = @site_a.pages.create!(:slug => 'root', :layout => layout)
|
121
121
|
page_1a = @site_a.pages.create!(:slug => 'test_a', :layout => layout)
|
122
122
|
page_1b = @site_a.pages.create!(:slug => 'test_b', :layout => layout)
|
@@ -137,7 +137,7 @@ class MirrorsTest < ActiveSupport::TestCase
|
|
137
137
|
end
|
138
138
|
|
139
139
|
def test_snippet_destroy
|
140
|
-
snippet_1 = @site_a.snippets.create(:
|
140
|
+
snippet_1 = @site_a.snippets.create(:identifier => 'test')
|
141
141
|
assert snippet_2 = snippet_1.mirrors.first
|
142
142
|
|
143
143
|
assert_difference ['@site_a.snippets.count', '@site_b.snippets.count'], -1 do
|