comfortable_mexican_sofa 1.12.2 → 1.12.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/assets/javascripts/comfortable_mexican_sofa/admin/application.js +1 -1
- data/app/assets/javascripts/comfortable_mexican_sofa/application.js.coffee +50 -57
- data/app/assets/javascripts/comfortable_mexican_sofa/cms/files.js.coffee +29 -0
- data/app/assets/javascripts/comfortable_mexican_sofa/cms/uploader.js.coffee +139 -0
- data/app/assets/stylesheets/comfortable_mexican_sofa/admin/application.css +1 -1
- data/app/assets/stylesheets/comfortable_mexican_sofa/application.css.sass +1 -0
- data/app/assets/stylesheets/comfortable_mexican_sofa/base.css.sass +67 -84
- data/app/controllers/comfy/admin/cms/base_controller.rb +11 -8
- data/app/controllers/comfy/admin/cms/categories_controller.rb +10 -9
- data/app/controllers/comfy/admin/cms/files_controller.rb +38 -69
- data/app/controllers/comfy/admin/cms/layouts_controller.rb +4 -3
- data/app/controllers/comfy/admin/cms/pages_controller.rb +17 -11
- data/app/controllers/comfy/admin/cms/revisions_controller.rb +10 -9
- data/app/controllers/comfy/admin/cms/sites_controller.rb +2 -1
- data/app/controllers/comfy/admin/cms/snippets_controller.rb +3 -2
- data/app/controllers/comfy/cms/assets_controller.rb +17 -9
- data/app/controllers/comfy/cms/content_controller.rb +20 -14
- data/app/models/comfy/cms/file.rb +16 -15
- data/app/models/comfy/cms/page.rb +2 -1
- data/app/models/comfy/cms/site.rb +5 -0
- data/app/views/comfy/admin/cms/files/_file.html.haml +26 -13
- data/app/views/comfy/admin/cms/files/_form.html.haml +8 -5
- data/app/views/comfy/admin/cms/files/_modal.html.haml +4 -0
- data/app/views/comfy/admin/cms/files/create.js.erb +1 -0
- data/app/views/comfy/admin/cms/files/destroy.js.coffee +2 -2
- data/app/views/comfy/admin/cms/files/index.html.haml +33 -31
- data/app/views/comfy/admin/cms/layouts/_form.html.haml +2 -5
- data/app/views/comfy/admin/cms/pages/_form.html.haml +7 -8
- data/app/views/comfy/admin/cms/pages/_form_blocks.html.haml +3 -3
- data/app/views/comfy/admin/cms/sites/_form.html.haml +2 -2
- data/app/views/comfy/admin/cms/sites/index.html.haml +1 -2
- data/app/views/comfy/admin/cms/snippets/_form.html.haml +5 -8
- data/app/views/kaminari/comfy/_paginator.html.haml +10 -11
- data/app/views/layouts/comfy/admin/cms.html.haml +3 -2
- data/app/views/layouts/comfy/admin/cms/_body.html.haml +8 -7
- data/app/views/layouts/comfy/admin/cms/{_center.html.haml → _flash.html.haml} +0 -3
- data/app/views/layouts/comfy/admin/cms/_footer_js.html.haml +0 -4
- data/app/views/layouts/comfy/admin/cms/_left.html.haml +10 -5
- data/comfortable_mexican_sofa.gemspec +9 -8
- data/config/cms_routes.rb +2 -2
- data/config/initializers/comfortable_mexican_sofa.rb +31 -13
- data/config/initializers/plupload.rb +9 -0
- data/config/locales/en.yml +18 -16
- data/db/upgrade_migrations/08_upgrade_to_1_12_0.rb +3 -0
- data/lib/comfortable_mexican_sofa.rb +6 -5
- data/lib/comfortable_mexican_sofa/access_control/admin_authentication.rb +20 -0
- data/lib/comfortable_mexican_sofa/access_control/admin_authorization.rb +8 -0
- data/lib/comfortable_mexican_sofa/access_control/public_authentication.rb +8 -0
- data/lib/comfortable_mexican_sofa/configuration.rb +11 -3
- data/lib/comfortable_mexican_sofa/engine.rb +1 -0
- data/lib/comfortable_mexican_sofa/fixture.rb +7 -5
- data/lib/comfortable_mexican_sofa/fixture/category.rb +10 -3
- data/lib/comfortable_mexican_sofa/form_builder.rb +1 -1
- data/lib/comfortable_mexican_sofa/routes/cms.rb +3 -0
- data/lib/comfortable_mexican_sofa/version.rb +1 -1
- data/lib/generators/comfy/cms/assets_generator.rb +15 -0
- data/lib/generators/comfy/cms/cms_generator.rb +19 -12
- data/lib/generators/comfy/cms/controllers_generator.rb +13 -0
- data/lib/generators/comfy/cms/models_generator.rb +13 -0
- data/lib/generators/comfy/cms/views_generator.rb +13 -0
- data/test/controllers/comfy/admin/cms/files_controller_test.rb +22 -95
- data/test/controllers/comfy/admin/cms/layouts_controller_test.rb +9 -10
- data/test/controllers/comfy/admin/cms/pages_controller_test.rb +26 -27
- data/test/controllers/comfy/admin/cms/snippets_controller_test.rb +7 -8
- data/test/controllers/comfy/cms/content_controller_test.rb +30 -4
- data/test/gemfiles/Gemfile.rails.4.0 +3 -2
- data/test/gemfiles/Gemfile.rails.4.1 +3 -2
- data/test/gemfiles/Gemfile.rails.master +3 -2
- data/test/generators/cms_assets_generator_test.rb +13 -0
- data/test/generators/cms_controllers_generator_test.rb +12 -0
- data/test/generators/cms_generator_test.rb +10 -8
- data/test/generators/cms_models_generator_test.rb +12 -0
- data/test/generators/cms_views_generator_test.rb +12 -0
- data/test/generators/scaffold_generator_test.rb +6 -7
- data/test/integration/access_control_test.rb +141 -0
- data/test/integration/routing_test.rb +19 -0
- data/test/lib/configuration_test.rb +8 -7
- data/test/lib/fixtures/categories_test.rb +1 -0
- data/test/lib/fixtures/files_test.rb +5 -0
- data/test/lib/fixtures/pages_test.rb +17 -1
- data/test/lib/fixtures/snippets_test.rb +5 -0
- data/test/models/page_test.rb +6 -0
- data/test/models/site_test.rb +9 -0
- data/test/test_helper.rb +28 -19
- metadata +82 -48
- data/app/views/comfy/admin/cms/files/_index.html.haml +0 -11
- data/lib/comfortable_mexican_sofa/authentication/dummy_auth.rb +0 -8
- data/lib/comfortable_mexican_sofa/authentication/http_auth.rb +0 -25
- data/test/integration/authentication_test.rb +0 -48
@@ -8,35 +8,35 @@ class Comfy::Admin::Cms::PagesControllerTest < ActionController::TestCase
|
|
8
8
|
assert assigns(:pages)
|
9
9
|
assert_template :index
|
10
10
|
end
|
11
|
-
|
11
|
+
|
12
12
|
def test_get_index_with_no_pages
|
13
13
|
Comfy::Cms::Page.delete_all
|
14
14
|
get :index, :site_id => comfy_cms_sites(:default)
|
15
15
|
assert_response :redirect
|
16
16
|
assert_redirected_to :action => :new
|
17
17
|
end
|
18
|
-
|
18
|
+
|
19
19
|
def test_get_index_with_category
|
20
20
|
category = comfy_cms_sites(:default).categories.create!(
|
21
21
|
:label => 'Test Category',
|
22
22
|
:categorized_type => 'Comfy::Cms::Page'
|
23
23
|
)
|
24
24
|
category.categorizations.create!(:categorized => comfy_cms_pages(:child))
|
25
|
-
|
25
|
+
|
26
26
|
get :index, :site_id => comfy_cms_sites(:default), :category => category.label
|
27
27
|
assert_response :success
|
28
28
|
assert assigns(:pages)
|
29
29
|
assert_equal 1, assigns(:pages).count
|
30
30
|
assert assigns(:pages).first.categories.member? category
|
31
31
|
end
|
32
|
-
|
32
|
+
|
33
33
|
def test_get_index_with_category_invalid
|
34
34
|
get :index, :site_id => comfy_cms_sites(:default), :category => 'invalid'
|
35
35
|
assert_response :success
|
36
36
|
assert assigns(:pages)
|
37
37
|
assert_equal 0, assigns(:pages).count
|
38
38
|
end
|
39
|
-
|
39
|
+
|
40
40
|
def test_get_index_with_toggle
|
41
41
|
comfy_cms_sites(:default).pages.create!(
|
42
42
|
:label => 'test',
|
@@ -47,7 +47,7 @@ class Comfy::Admin::Cms::PagesControllerTest < ActionController::TestCase
|
|
47
47
|
get :index, :site_id => comfy_cms_sites(:default)
|
48
48
|
assert_response :success
|
49
49
|
end
|
50
|
-
|
50
|
+
|
51
51
|
def test_get_new
|
52
52
|
site = comfy_cms_sites(:default)
|
53
53
|
get :new, :site_id => site
|
@@ -57,7 +57,6 @@ class Comfy::Admin::Cms::PagesControllerTest < ActionController::TestCase
|
|
57
57
|
assert_template :new
|
58
58
|
assert_select "form[action=/admin/sites/#{site.id}/pages]"
|
59
59
|
assert_select "select[data-url=/admin/sites/#{site.id}/pages/0/form_blocks]"
|
60
|
-
assert_select "form[action='/admin/sites/#{site.id}/files?ajax=true']"
|
61
60
|
end
|
62
61
|
|
63
62
|
def test_get_new_with_field_datetime
|
@@ -91,7 +90,7 @@ class Comfy::Admin::Cms::PagesControllerTest < ActionController::TestCase
|
|
91
90
|
assert_select "textarea[name='page[blocks_attributes][0][content]'][data-cms-cm-mode='text/html']"
|
92
91
|
assert_select "input[type='hidden'][name='page[blocks_attributes][0][identifier]'][value='test_label']"
|
93
92
|
end
|
94
|
-
|
93
|
+
|
95
94
|
def test_get_new_with_field_rich_text
|
96
95
|
comfy_cms_layouts(:default).update_columns(:content => '{{cms:field:test_label:rich_text}}')
|
97
96
|
get :new, :site_id => comfy_cms_sites(:default)
|
@@ -131,7 +130,7 @@ class Comfy::Admin::Cms::PagesControllerTest < ActionController::TestCase
|
|
131
130
|
assert_select "textarea[name='page[blocks_attributes][0][content]'][data-cms-cm-mode=text/html]"
|
132
131
|
assert_select "input[type='hidden'][name='page[blocks_attributes][0][identifier]'][value='test_label']"
|
133
132
|
end
|
134
|
-
|
133
|
+
|
135
134
|
def test_get_new_with_page_file
|
136
135
|
comfy_cms_layouts(:default).update_columns(:content => '{{cms:page_file:test_label}}')
|
137
136
|
get :new, :site_id => comfy_cms_sites(:default)
|
@@ -139,7 +138,7 @@ class Comfy::Admin::Cms::PagesControllerTest < ActionController::TestCase
|
|
139
138
|
assert_select "input[type='file'][name='page[blocks_attributes][0][content]']"
|
140
139
|
assert_select "input[type='hidden'][name='page[blocks_attributes][0][identifier]'][value='test_label']"
|
141
140
|
end
|
142
|
-
|
141
|
+
|
143
142
|
def test_get_new_with_page_files
|
144
143
|
comfy_cms_layouts(:default).update_columns(:content => '{{cms:page_files:test_label}}')
|
145
144
|
get :new, :site_id => comfy_cms_sites(:default)
|
@@ -147,7 +146,7 @@ class Comfy::Admin::Cms::PagesControllerTest < ActionController::TestCase
|
|
147
146
|
assert_select "input[type='file'][name='page[blocks_attributes][0][content][]'][multiple=multiple]"
|
148
147
|
assert_select "input[type='hidden'][name='page[blocks_attributes][0][identifier]'][value='test_label']"
|
149
148
|
end
|
150
|
-
|
149
|
+
|
151
150
|
def test_get_new_with_collection
|
152
151
|
snippet = comfy_cms_snippets(:default)
|
153
152
|
comfy_cms_layouts(:default).update_columns(:content => '{{cms:collection:snippet:comfy/cms/snippet}}')
|
@@ -167,7 +166,7 @@ class Comfy::Admin::Cms::PagesControllerTest < ActionController::TestCase
|
|
167
166
|
assert_select "textarea[name='page[blocks_attributes][0][content]'][data-cms-rich-text]"
|
168
167
|
assert_select "input[type='hidden'][name='page[blocks_attributes][0][identifier]'][value='test_label']"
|
169
168
|
end
|
170
|
-
|
169
|
+
|
171
170
|
def test_get_new_with_page_markdown
|
172
171
|
comfy_cms_layouts(:default).update_columns(:content => '{{cms:page:test_label:markdown}}')
|
173
172
|
get :new, :site_id => comfy_cms_sites(:default)
|
@@ -175,7 +174,7 @@ class Comfy::Admin::Cms::PagesControllerTest < ActionController::TestCase
|
|
175
174
|
assert_select "textarea[name='page[blocks_attributes][0][content]'][data-cms-cm-mode=text/x-markdown]"
|
176
175
|
assert_select "input[type='hidden'][name='page[blocks_attributes][0][identifier]'][value='test_label']"
|
177
176
|
end
|
178
|
-
|
177
|
+
|
179
178
|
def test_get_new_with_boolean_field
|
180
179
|
comfy_cms_layouts(:default).update_columns(:content => '{{cms:field:test_label:boolean}}')
|
181
180
|
get :new, :site_id => comfy_cms_sites(:default)
|
@@ -184,7 +183,7 @@ class Comfy::Admin::Cms::PagesControllerTest < ActionController::TestCase
|
|
184
183
|
assert_select "input[type='hidden'][name='page[blocks_attributes][0][content]'][value='']"
|
185
184
|
assert_select "input[type='checkbox'][name='page[blocks_attributes][0][content]'][value='1']"
|
186
185
|
end
|
187
|
-
|
186
|
+
|
188
187
|
def test_get_new_with_several_tag_fields
|
189
188
|
comfy_cms_layouts(:default).update_columns(:content => '{{cms:page:label_a}}{{cms:page:label_b}}')
|
190
189
|
get :new, :site_id => comfy_cms_sites(:default)
|
@@ -194,18 +193,18 @@ class Comfy::Admin::Cms::PagesControllerTest < ActionController::TestCase
|
|
194
193
|
assert_select "textarea[name='page[blocks_attributes][1][content]']"
|
195
194
|
assert_select "input[type='hidden'][name='page[blocks_attributes][1][identifier]'][value='label_b']"
|
196
195
|
end
|
197
|
-
|
196
|
+
|
198
197
|
def test_get_new_with_crashy_tag
|
199
198
|
comfy_cms_layouts(:default).update_columns(:content => '{{cms:collection:label:invalid}}')
|
200
|
-
assert_exception_raised do
|
199
|
+
assert_exception_raised do
|
201
200
|
get :new, :site_id => comfy_cms_sites(:default)
|
202
201
|
end
|
203
|
-
|
202
|
+
|
204
203
|
Rails.stubs(:env => ActiveSupport::StringInquirer.new('production'))
|
205
204
|
get :new, :site_id => comfy_cms_sites(:default)
|
206
205
|
assert_response :success
|
207
206
|
end
|
208
|
-
|
207
|
+
|
209
208
|
def test_get_new_with_repeated_tag
|
210
209
|
comfy_cms_layouts(:default).update_columns(:content => '{{cms:page:test_label}}{{cms:page:test_label}}')
|
211
210
|
get :new, :site_id => comfy_cms_sites(:default)
|
@@ -215,7 +214,7 @@ class Comfy::Admin::Cms::PagesControllerTest < ActionController::TestCase
|
|
215
214
|
assert_select "textarea[name='page[blocks_attributes][1][content]']", 0
|
216
215
|
assert_select "input[type='hidden'][name='page[blocks_attributes][1][identifier]'][value='test_label']", 0
|
217
216
|
end
|
218
|
-
|
217
|
+
|
219
218
|
def test_get_new_as_child_page
|
220
219
|
get :new, :site_id => comfy_cms_sites(:default), :parent_id => comfy_cms_pages(:default)
|
221
220
|
assert_response :success
|
@@ -249,21 +248,21 @@ class Comfy::Admin::Cms::PagesControllerTest < ActionController::TestCase
|
|
249
248
|
assert assigns(:page)
|
250
249
|
assert assigns(:page).layout
|
251
250
|
end
|
252
|
-
|
251
|
+
|
253
252
|
def test_get_edit_with_non_english_locale
|
254
253
|
site = comfy_cms_sites(:default)
|
255
254
|
site.update_columns(:locale => 'es')
|
256
255
|
get :edit, :site_id => site, :id => comfy_cms_pages(:default)
|
257
256
|
assert_response :success
|
258
257
|
end
|
259
|
-
|
258
|
+
|
260
259
|
def test_get_edit_with_layout_and_no_tags
|
261
260
|
page = comfy_cms_pages(:default)
|
262
261
|
page.layout.update_column(:content, '')
|
263
262
|
get :edit, :site_id => page.site, :id => page
|
264
263
|
assert_response :success
|
265
264
|
end
|
266
|
-
|
265
|
+
|
267
266
|
def test_creation
|
268
267
|
assert_difference 'Comfy::Cms::Page.count' do
|
269
268
|
assert_difference 'Comfy::Cms::Block.count', 2 do
|
@@ -287,7 +286,7 @@ class Comfy::Admin::Cms::PagesControllerTest < ActionController::TestCase
|
|
287
286
|
end
|
288
287
|
end
|
289
288
|
end
|
290
|
-
|
289
|
+
|
291
290
|
def test_creation_failure
|
292
291
|
assert_no_difference ['Comfy::Cms::Page.count', 'Comfy::Cms::Block.count'] do
|
293
292
|
post :create, :site_id => comfy_cms_sites(:default), :page => {
|
@@ -321,7 +320,7 @@ class Comfy::Admin::Cms::PagesControllerTest < ActionController::TestCase
|
|
321
320
|
assert_equal 'Updated Label', page.label
|
322
321
|
end
|
323
322
|
end
|
324
|
-
|
323
|
+
|
325
324
|
def test_update_with_layout_change
|
326
325
|
page = comfy_cms_pages(:default)
|
327
326
|
assert_difference 'Comfy::Cms::Block.count', 2 do
|
@@ -392,7 +391,7 @@ class Comfy::Admin::Cms::PagesControllerTest < ActionController::TestCase
|
|
392
391
|
def test_creation_preview
|
393
392
|
site = comfy_cms_sites(:default)
|
394
393
|
layout = comfy_cms_layouts(:default)
|
395
|
-
|
394
|
+
|
396
395
|
assert_no_difference 'Comfy::Cms::Page.count' do
|
397
396
|
post :create, :site_id => site, :preview => 'Preview', :page => {
|
398
397
|
:label => 'Test Page',
|
@@ -407,7 +406,7 @@ class Comfy::Admin::Cms::PagesControllerTest < ActionController::TestCase
|
|
407
406
|
assert_response :success
|
408
407
|
assert_match /preview content/, response.body
|
409
408
|
assert_equal 'text/html', response.content_type
|
410
|
-
|
409
|
+
|
411
410
|
assert_equal site, assigns(:cms_site)
|
412
411
|
assert_equal layout, assigns(:cms_layout)
|
413
412
|
assert assigns(:cms_page)
|
@@ -429,7 +428,7 @@ class Comfy::Admin::Cms::PagesControllerTest < ActionController::TestCase
|
|
429
428
|
assert_match /preview content/, response.body
|
430
429
|
page.reload
|
431
430
|
assert_not_equal 'Updated Label', page.label
|
432
|
-
|
431
|
+
|
433
432
|
assert_equal page.site, assigns(:cms_site)
|
434
433
|
assert_equal page.layout, assigns(:cms_layout)
|
435
434
|
assert_equal page, assigns(:cms_page)
|
@@ -15,18 +15,18 @@ class Comfy::Admin::Cms::SnippetsControllerTest < ActionController::TestCase
|
|
15
15
|
assert_response :redirect
|
16
16
|
assert_redirected_to :action => :new
|
17
17
|
end
|
18
|
-
|
18
|
+
|
19
19
|
def test_get_index_with_category
|
20
20
|
category = comfy_cms_sites(:default).categories.create!(:label => 'Test Category', :categorized_type => 'Comfy::Cms::Snippet')
|
21
21
|
category.categorizations.create!(:categorized => comfy_cms_snippets(:default))
|
22
|
-
|
22
|
+
|
23
23
|
get :index, :site_id => comfy_cms_sites(:default), :category => category.label
|
24
24
|
assert_response :success
|
25
25
|
assert assigns(:snippets)
|
26
26
|
assert_equal 1, assigns(:snippets).count
|
27
27
|
assert assigns(:snippets).first.categories.member? category
|
28
28
|
end
|
29
|
-
|
29
|
+
|
30
30
|
def test_get_index_with_category_invalid
|
31
31
|
get :index, :site_id => comfy_cms_sites(:default), :category => 'invalid'
|
32
32
|
assert_response :success
|
@@ -41,7 +41,6 @@ class Comfy::Admin::Cms::SnippetsControllerTest < ActionController::TestCase
|
|
41
41
|
assert assigns(:snippet)
|
42
42
|
assert_template :new
|
43
43
|
assert_select "form[action=/admin/sites/#{site.id}/snippets]"
|
44
|
-
assert_select "form[action='/admin/sites/#{site.id}/files?ajax=true']"
|
45
44
|
end
|
46
45
|
|
47
46
|
def test_get_edit
|
@@ -52,7 +51,7 @@ class Comfy::Admin::Cms::SnippetsControllerTest < ActionController::TestCase
|
|
52
51
|
assert_template :edit
|
53
52
|
assert_select "form[action=/admin/sites/#{snippet.site.id}/snippets/#{snippet.id}]"
|
54
53
|
end
|
55
|
-
|
54
|
+
|
56
55
|
def test_get_edit_with_params
|
57
56
|
snippet = comfy_cms_snippets(:default)
|
58
57
|
get :edit, :site_id => snippet.site, :id => snippet, :snippet => {:label => 'New Label'}
|
@@ -67,7 +66,7 @@ class Comfy::Admin::Cms::SnippetsControllerTest < ActionController::TestCase
|
|
67
66
|
assert_redirected_to :action => :index
|
68
67
|
assert_equal 'Snippet not found', flash[:danger]
|
69
68
|
end
|
70
|
-
|
69
|
+
|
71
70
|
def test_create
|
72
71
|
assert_difference 'Comfy::Cms::Snippet.count' do
|
73
72
|
post :create, :site_id => comfy_cms_sites(:default), :snippet => {
|
@@ -126,7 +125,7 @@ class Comfy::Admin::Cms::SnippetsControllerTest < ActionController::TestCase
|
|
126
125
|
assert_equal 'Snippet deleted', flash[:success]
|
127
126
|
end
|
128
127
|
end
|
129
|
-
|
128
|
+
|
130
129
|
def test_reorder
|
131
130
|
snippet_one = comfy_cms_snippets(:default)
|
132
131
|
snippet_two = comfy_cms_sites(:default).snippets.create!(
|
@@ -145,4 +144,4 @@ class Comfy::Admin::Cms::SnippetsControllerTest < ActionController::TestCase
|
|
145
144
|
assert_equal 0, snippet_two.position
|
146
145
|
end
|
147
146
|
|
148
|
-
end
|
147
|
+
end
|
@@ -25,13 +25,15 @@ class Comfy::Cms::ContentControllerTest < ActionController::TestCase
|
|
25
25
|
def test_show_default_html
|
26
26
|
@request.headers["Accept"] = "*/*"
|
27
27
|
get :show, :cms_path => ''
|
28
|
+
assert_response :success
|
28
29
|
assert_equal 'text/html', response.content_type
|
29
30
|
end
|
30
|
-
|
31
|
+
|
31
32
|
def test_show_as_json
|
32
33
|
get :show, :cms_path => '', :format => 'json'
|
33
34
|
assert_response :success
|
34
|
-
|
35
|
+
assert_equal 'application/json', response.content_type
|
36
|
+
|
35
37
|
content = rendered_content_formatter(
|
36
38
|
'
|
37
39
|
layout_content_a
|
@@ -58,12 +60,36 @@ class Comfy::Cms::ContentControllerTest < ActionController::TestCase
|
|
58
60
|
assert_equal true, json_response['is_published']
|
59
61
|
end
|
60
62
|
|
63
|
+
def test_show_with_custom_mimetype
|
64
|
+
layout = comfy_cms_sites(:default).layouts.create!(
|
65
|
+
:label => 'RSS Layout',
|
66
|
+
:identifier => 'rss-layout',
|
67
|
+
:content => '{{cms:field:mime_type}}{{cms:page:content}}',
|
68
|
+
)
|
69
|
+
page = comfy_cms_sites(:default).pages.create!(
|
70
|
+
:label => 'rss',
|
71
|
+
:slug => 'rss',
|
72
|
+
:parent_id => comfy_cms_pages(:default).id,
|
73
|
+
:layout_id => layout.id,
|
74
|
+
:is_published => true,
|
75
|
+
:blocks_attributes => [
|
76
|
+
{ :identifier => 'content',
|
77
|
+
:content => 'content' },
|
78
|
+
{ :identifier => 'mime_type',
|
79
|
+
:content => 'application/rss+xml' }
|
80
|
+
]
|
81
|
+
)
|
82
|
+
get :show, :cms_path => 'rss'
|
83
|
+
assert_response :success
|
84
|
+
assert_equal 'application/rss+xml', response.content_type
|
85
|
+
end
|
86
|
+
|
61
87
|
def test_show_with_app_layout
|
62
88
|
comfy_cms_layouts(:default).update_columns(:app_layout => 'comfy/admin/cms')
|
63
89
|
get :show, :cms_path => ''
|
64
90
|
assert_response :success
|
65
91
|
assert assigns(:cms_page)
|
66
|
-
assert_select "body
|
92
|
+
assert_select "body.c-comfy-cms-content.a-show"
|
67
93
|
end
|
68
94
|
|
69
95
|
def test_show_with_xhr
|
@@ -71,7 +97,7 @@ class Comfy::Cms::ContentControllerTest < ActionController::TestCase
|
|
71
97
|
xhr :get, :show, :cms_path => ''
|
72
98
|
assert_response :success
|
73
99
|
assert assigns(:cms_page)
|
74
|
-
assert_no_select "body
|
100
|
+
assert_no_select "body.c-comfy-cms-content.a-show"
|
75
101
|
end
|
76
102
|
|
77
103
|
def test_show_not_found
|
@@ -13,10 +13,11 @@ gem 'coffee-rails', '>= 3.1.0'
|
|
13
13
|
gem 'codemirror-rails', '>= 3.0.0'
|
14
14
|
gem 'kaminari', '>= 0.14.0'
|
15
15
|
gem 'tinymce-rails', '>= 4.0.0'
|
16
|
-
gem 'bootstrap-sass', '~> 3.
|
16
|
+
gem 'bootstrap-sass', '~> 3.2.0'
|
17
|
+
gem 'plupload-rails', '~> 1.2.1'
|
17
18
|
|
18
19
|
group :test do
|
19
20
|
gem 'sqlite3'
|
20
21
|
gem 'coveralls', :require => false
|
21
22
|
gem 'mocha', :require => false
|
22
|
-
end
|
23
|
+
end
|
@@ -13,10 +13,11 @@ gem 'coffee-rails', '>= 3.1.0'
|
|
13
13
|
gem 'codemirror-rails', '>= 3.0.0'
|
14
14
|
gem 'kaminari', '>= 0.14.0'
|
15
15
|
gem 'tinymce-rails', '>= 4.0.0'
|
16
|
-
gem 'bootstrap-sass', '~> 3.
|
16
|
+
gem 'bootstrap-sass', '~> 3.2.0'
|
17
|
+
gem 'plupload-rails', '~> 1.2.1'
|
17
18
|
|
18
19
|
group :test do
|
19
20
|
gem 'sqlite3'
|
20
21
|
gem 'coveralls', :require => false
|
21
22
|
gem 'mocha', :require => false
|
22
|
-
end
|
23
|
+
end
|
@@ -13,10 +13,11 @@ gem 'coffee-rails', '>= 3.1.0'
|
|
13
13
|
gem 'codemirror-rails', '>= 3.0.0'
|
14
14
|
gem 'kaminari', '>= 0.14.0'
|
15
15
|
gem 'tinymce-rails', '>= 4.0.0'
|
16
|
-
gem 'bootstrap-sass', '~> 3.
|
16
|
+
gem 'bootstrap-sass', '~> 3.2.0'
|
17
|
+
gem 'plupload-rails', '~> 1.2.1'
|
17
18
|
|
18
19
|
group :test do
|
19
20
|
gem 'sqlite3'
|
20
21
|
gem 'coveralls', :require => false
|
21
22
|
gem 'mocha', :require => false
|
22
|
-
end
|
23
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
require_relative '../test_helper'
|
2
|
+
require_relative '../../lib/generators/comfy/cms/assets_generator'
|
3
|
+
|
4
|
+
class CmsAssetsGeneratorTest < Rails::Generators::TestCase
|
5
|
+
tests Comfy::Generators::Cms::AssetsGenerator
|
6
|
+
|
7
|
+
def test_generator
|
8
|
+
run_generator
|
9
|
+
assert_directory 'app/assets/images/comfortable_mexican_sofa'
|
10
|
+
assert_directory 'app/assets/javascripts/comfortable_mexican_sofa'
|
11
|
+
assert_directory 'app/assets/stylesheets/comfortable_mexican_sofa'
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
require_relative '../test_helper'
|
2
|
+
require_relative '../../lib/generators/comfy/cms/controllers_generator'
|
3
|
+
|
4
|
+
class CmsControllersGeneratorTest < Rails::Generators::TestCase
|
5
|
+
tests Comfy::Generators::Cms::ControllersGenerator
|
6
|
+
|
7
|
+
def test_generator
|
8
|
+
run_generator
|
9
|
+
assert_directory 'app/controllers/comfy'
|
10
|
+
assert_file 'app/controllers/comfy/admin/cms/base_controller.rb'
|
11
|
+
end
|
12
|
+
end
|
@@ -3,21 +3,23 @@ require_relative '../../lib/generators/comfy/cms/cms_generator'
|
|
3
3
|
|
4
4
|
class CmsGeneratorTest < Rails::Generators::TestCase
|
5
5
|
tests Comfy::Generators::CmsGenerator
|
6
|
-
|
6
|
+
|
7
7
|
def test_generator
|
8
8
|
run_generator
|
9
|
-
|
9
|
+
|
10
10
|
assert_migration 'db/migrate/create_cms.rb'
|
11
|
-
|
11
|
+
|
12
12
|
assert_file 'config/initializers/comfortable_mexican_sofa.rb'
|
13
|
-
|
13
|
+
assert_file 'config/initializers/mime_types.rb' do |file|
|
14
|
+
assert_match "Mime::Type.register 'text/plupload', :plupload", file
|
15
|
+
end
|
16
|
+
|
14
17
|
assert_file 'config/routes.rb', read_file('cms/routes.rb')
|
15
|
-
|
18
|
+
|
16
19
|
assert_directory 'db/cms_fixtures'
|
17
|
-
|
20
|
+
|
18
21
|
assert_file 'app/assets/javascripts/comfortable_mexican_sofa/admin/application.js'
|
19
|
-
|
22
|
+
|
20
23
|
assert_file 'app/assets/stylesheets/comfortable_mexican_sofa/admin/application.css'
|
21
24
|
end
|
22
|
-
|
23
25
|
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
require_relative '../test_helper'
|
2
|
+
require_relative '../../lib/generators/comfy/cms/models_generator'
|
3
|
+
|
4
|
+
class CmsModelsGeneratorTest < Rails::Generators::TestCase
|
5
|
+
tests Comfy::Generators::Cms::ModelsGenerator
|
6
|
+
|
7
|
+
def test_generator
|
8
|
+
run_generator
|
9
|
+
assert_directory 'app/models/comfy'
|
10
|
+
assert_file 'app/models/comfy/cms/page.rb'
|
11
|
+
end
|
12
|
+
end
|