comfortable_mexican_sofa 1.2.8 → 1.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (75) hide show
  1. data/Gemfile +1 -1
  2. data/README.md +1 -1
  3. data/VERSION +1 -1
  4. data/app/assets/javascripts/comfortable_mexican_sofa/application.js +3 -3
  5. data/app/assets/javascripts/comfortable_mexican_sofa/wymeditor/jquery.wymeditor.cms.js +1 -1
  6. data/app/assets/stylesheets/comfortable_mexican_sofa/structure.css +1 -1
  7. data/app/controllers/cms_admin/base_controller.rb +22 -25
  8. data/app/controllers/cms_admin/layouts_controller.rb +21 -21
  9. data/app/controllers/cms_admin/pages_controller.rb +29 -29
  10. data/app/controllers/cms_admin/revisions_controller.rb +6 -6
  11. data/app/controllers/cms_admin/sites_controller.rb +21 -20
  12. data/app/controllers/cms_admin/snippets_controller.rb +19 -20
  13. data/app/controllers/cms_admin/uploads_controller.rb +6 -6
  14. data/app/controllers/cms_content_controller.rb +30 -16
  15. data/app/models/cms/layout.rb +2 -9
  16. data/app/models/cms/site.rb +11 -6
  17. data/app/views/cms_admin/layouts/_form.html.erb +6 -6
  18. data/app/views/cms_admin/layouts/_index_branch.html.erb +10 -10
  19. data/app/views/cms_admin/layouts/edit.html.erb +6 -5
  20. data/app/views/cms_admin/layouts/index.html.erb +3 -3
  21. data/app/views/cms_admin/layouts/new.html.erb +3 -3
  22. data/app/views/cms_admin/pages/_form.html.erb +11 -11
  23. data/app/views/cms_admin/pages/_form_blocks.html.erb +3 -4
  24. data/app/views/cms_admin/pages/_index_branch.html.erb +15 -15
  25. data/app/views/cms_admin/pages/edit.html.erb +6 -5
  26. data/app/views/cms_admin/pages/index.html.erb +4 -4
  27. data/app/views/cms_admin/pages/new.html.erb +3 -3
  28. data/app/views/cms_admin/pages/toggle_branch.js.erb +3 -3
  29. data/app/views/cms_admin/revisions/show.html.erb +4 -4
  30. data/app/views/cms_admin/sites/_form.html.erb +5 -2
  31. data/app/views/cms_admin/sites/_mirrors.html.erb +6 -6
  32. data/app/views/cms_admin/sites/edit.html.erb +3 -3
  33. data/app/views/cms_admin/sites/index.html.erb +9 -9
  34. data/app/views/cms_admin/sites/new.html.erb +3 -3
  35. data/app/views/cms_admin/snippets/_form.html.erb +3 -3
  36. data/app/views/cms_admin/snippets/edit.html.erb +5 -5
  37. data/app/views/cms_admin/snippets/index.html.erb +9 -9
  38. data/app/views/cms_admin/snippets/new.html.erb +3 -3
  39. data/app/views/cms_admin/uploads/_file.html.erb +1 -1
  40. data/app/views/cms_admin/uploads/_index.html.erb +2 -2
  41. data/app/views/cms_admin/uploads/destroy.js.erb +1 -1
  42. data/app/views/layouts/cms_admin/_head.html.erb +2 -0
  43. data/app/views/layouts/cms_admin/_left.html.erb +6 -6
  44. data/comfortable_mexican_sofa.gemspec +10 -6
  45. data/config/boot.rb +3 -10
  46. data/config/initializers/comfortable_mexican_sofa.rb +14 -22
  47. data/config/locales/en.yml +179 -4
  48. data/config/locales/es.yml +179 -0
  49. data/config/routes.rb +25 -27
  50. data/db/migrate/01_create_cms.rb +8 -1
  51. data/db/migrate/upgrades/04_upgrade_to_1_3_0.rb +23 -0
  52. data/lib/comfortable_mexican_sofa/configuration.rb +15 -19
  53. data/lib/comfortable_mexican_sofa/fixtures.rb +12 -3
  54. data/lib/comfortable_mexican_sofa/form_builder.rb +7 -6
  55. data/lib/comfortable_mexican_sofa/is_mirrored.rb +9 -11
  56. data/lib/comfortable_mexican_sofa/tags/asset.rb +2 -2
  57. data/test/fixtures/cms/sites.yml +3 -1
  58. data/test/functional/cms_admin/base_controller_test.rb +18 -0
  59. data/test/functional/cms_admin/layouts_controller_test.rb +20 -19
  60. data/test/functional/cms_admin/pages_controller_test.rb +73 -71
  61. data/test/functional/cms_admin/revisions_controller_test.rb +23 -20
  62. data/test/functional/cms_admin/sites_controller_test.rb +8 -8
  63. data/test/functional/cms_admin/snippets_controller_test.rb +17 -16
  64. data/test/functional/cms_admin/uploads_controller_test.rb +3 -3
  65. data/test/integration/authentication_test.rb +4 -4
  66. data/test/integration/fixtures_test.rb +1 -1
  67. data/test/integration/mirrors_test.rb +15 -18
  68. data/test/integration/routing_extensions_test.rb +4 -19
  69. data/test/integration/sites_test.rb +67 -48
  70. data/test/test_helper.rb +26 -6
  71. data/test/unit/configuration_test.rb +5 -5
  72. data/test/unit/form_builder_test.rb +69 -0
  73. data/test/unit/mirrors_test.rb +2 -6
  74. data/test/unit/models/site_test.rb +30 -3
  75. metadata +55 -56
@@ -3,32 +3,32 @@ require File.expand_path('../../test_helper', File.dirname(__FILE__))
3
3
  class CmsAdmin::RevisionsControllerTest < ActionController::TestCase
4
4
 
5
5
  def test_get_index_for_layouts
6
- get :index, :layout_id => cms_layouts(:default)
6
+ get :index, :site_id => cms_sites(:default), :layout_id => cms_layouts(:default)
7
7
  assert_response :redirect
8
8
  assert_redirected_to :action => :show, :id => cms_revisions(:layout)
9
9
  end
10
10
 
11
11
  def test_get_index_for_pages
12
- get :index, :page_id => cms_pages(:default)
12
+ get :index, :site_id => cms_sites(:default), :page_id => cms_pages(:default)
13
13
  assert_response :redirect
14
14
  assert_redirected_to :action => :show, :id => cms_revisions(:page)
15
15
  end
16
16
 
17
17
  def test_get_index_for_snippets
18
- get :index, :snippet_id => cms_snippets(:default)
18
+ get :index, :site_id => cms_sites(:default), :snippet_id => cms_snippets(:default)
19
19
  assert_response :redirect
20
20
  assert_redirected_to :action => :show, :id => cms_revisions(:snippet)
21
21
  end
22
22
 
23
23
  def test_get_index_for_snippets_with_no_revisions
24
24
  Cms::Revision.delete_all
25
- get :index, :snippet_id => cms_snippets(:default)
25
+ get :index, :site_id => cms_sites(:default), :snippet_id => cms_snippets(:default)
26
26
  assert_response :redirect
27
27
  assert_redirected_to :action => :show, :id => 0
28
28
  end
29
29
 
30
30
  def test_get_show_for_layout
31
- get :show, :layout_id => cms_layouts(:default), :id => cms_revisions(:layout)
31
+ get :show, :site_id => cms_sites(:default), :layout_id => cms_layouts(:default), :id => cms_revisions(:layout)
32
32
  assert_response :success
33
33
  assert assigns(:record)
34
34
  assert assigns(:revision)
@@ -37,7 +37,7 @@ class CmsAdmin::RevisionsControllerTest < ActionController::TestCase
37
37
  end
38
38
 
39
39
  def test_get_show_for_page
40
- get :show, :page_id => cms_pages(:default), :id => cms_revisions(:page)
40
+ get :show, :site_id => cms_sites(:default), :page_id => cms_pages(:default), :id => cms_revisions(:page)
41
41
  assert_response :success
42
42
  assert assigns(:record)
43
43
  assert assigns(:revision)
@@ -46,7 +46,7 @@ class CmsAdmin::RevisionsControllerTest < ActionController::TestCase
46
46
  end
47
47
 
48
48
  def test_get_show_for_snippet
49
- get :show, :snippet_id => cms_snippets(:default), :id => cms_revisions(:snippet)
49
+ get :show, :site_id => cms_sites(:default), :snippet_id => cms_snippets(:default), :id => cms_revisions(:snippet)
50
50
  assert_response :success
51
51
  assert assigns(:record)
52
52
  assert assigns(:revision)
@@ -55,33 +55,36 @@ class CmsAdmin::RevisionsControllerTest < ActionController::TestCase
55
55
  end
56
56
 
57
57
  def test_get_show_for_bad_type
58
- get :show, :snippet_id => 'invalid', :id => cms_revisions(:snippet)
58
+ get :show, :site_id => cms_sites(:default), :snippet_id => 'invalid', :id => cms_revisions(:snippet)
59
59
  assert_response :redirect
60
60
  assert_redirected_to cms_admin_path
61
61
  assert_equal 'Record Not Found', flash[:error]
62
62
  end
63
63
 
64
64
  def test_get_show_for_layout_failure
65
- get :show, :layout_id => cms_layouts(:default), :id => 'invalid'
65
+ site = cms_sites(:default)
66
+ get :show, :site_id => site, :layout_id => cms_layouts(:default), :id => 'invalid'
66
67
  assert_response :redirect
67
68
  assert assigns(:record)
68
- assert_redirected_to edit_cms_admin_layout_path(assigns(:record))
69
+ assert_redirected_to edit_cms_admin_site_layout_path(site, assigns(:record))
69
70
  assert_equal 'Revision Not Found', flash[:error]
70
71
  end
71
72
 
72
73
  def test_get_show_for_page_failure
73
- get :show, :page_id => cms_pages(:default), :id => 'invalid'
74
+ site = cms_sites(:default)
75
+ get :show, :site_id => site, :page_id => cms_pages(:default), :id => 'invalid'
74
76
  assert_response :redirect
75
77
  assert assigns(:record)
76
- assert_redirected_to edit_cms_admin_page_path(assigns(:record))
78
+ assert_redirected_to edit_cms_admin_site_page_path(site, assigns(:record))
77
79
  assert_equal 'Revision Not Found', flash[:error]
78
80
  end
79
81
 
80
82
  def test_get_show_for_snippet_failure
81
- get :show, :snippet_id => cms_snippets(:default), :id => 'invalid'
83
+ site = cms_sites(:default)
84
+ get :show, :site_id => site, :snippet_id => cms_snippets(:default), :id => 'invalid'
82
85
  assert_response :redirect
83
86
  assert assigns(:record)
84
- assert_redirected_to edit_cms_admin_snippet_path(assigns(:record))
87
+ assert_redirected_to edit_cms_admin_site_snippet_path(site, assigns(:record))
85
88
  assert_equal 'Revision Not Found', flash[:error]
86
89
  end
87
90
 
@@ -89,9 +92,9 @@ class CmsAdmin::RevisionsControllerTest < ActionController::TestCase
89
92
  layout = cms_layouts(:default)
90
93
 
91
94
  assert_difference 'layout.revisions.count' do
92
- put :revert, :layout_id => layout, :id => cms_revisions(:layout)
95
+ put :revert, :site_id => cms_sites(:default), :layout_id => layout, :id => cms_revisions(:layout)
93
96
  assert_response :redirect
94
- assert_redirected_to edit_cms_admin_layout_path(layout)
97
+ assert_redirected_to edit_cms_admin_site_layout_path(layout.site, layout)
95
98
  assert_equal 'Content Reverted', flash[:notice]
96
99
 
97
100
  layout.reload
@@ -105,9 +108,9 @@ class CmsAdmin::RevisionsControllerTest < ActionController::TestCase
105
108
  page = cms_pages(:default)
106
109
 
107
110
  assert_difference 'page.revisions.count' do
108
- put :revert, :page_id => page, :id => cms_revisions(:page)
111
+ put :revert, :site_id => cms_sites(:default), :page_id => page, :id => cms_revisions(:page)
109
112
  assert_response :redirect
110
- assert_redirected_to edit_cms_admin_page_path(page)
113
+ assert_redirected_to edit_cms_admin_site_page_path(page.site, page)
111
114
  assert_equal 'Content Reverted', flash[:notice]
112
115
 
113
116
  page.reload
@@ -122,9 +125,9 @@ class CmsAdmin::RevisionsControllerTest < ActionController::TestCase
122
125
  snippet = cms_snippets(:default)
123
126
 
124
127
  assert_difference 'snippet.revisions.count' do
125
- put :revert, :snippet_id => snippet, :id => cms_revisions(:snippet)
128
+ put :revert, :site_id => cms_sites(:default), :snippet_id => snippet, :id => cms_revisions(:snippet)
126
129
  assert_response :redirect
127
- assert_redirected_to edit_cms_admin_snippet_path(snippet)
130
+ assert_redirected_to edit_cms_admin_site_snippet_path(snippet.site, snippet)
128
131
  assert_equal 'Content Reverted', flash[:notice]
129
132
 
130
133
  snippet.reload
@@ -5,7 +5,7 @@ class CmsAdmin::SitesControllerTest < ActionController::TestCase
5
5
  def test_get_index
6
6
  get :index
7
7
  assert_response :success
8
- assert assigns(:cms_sites)
8
+ assert assigns(:sites)
9
9
  assert_template :index
10
10
  end
11
11
 
@@ -19,8 +19,8 @@ class CmsAdmin::SitesControllerTest < ActionController::TestCase
19
19
  def test_get_new
20
20
  get :new
21
21
  assert_response :success
22
- assert assigns(:cms_site)
23
- assert_equal 'test.host', assigns(:cms_site).hostname
22
+ assert assigns(:site)
23
+ assert_equal 'test.host', assigns(:site).hostname
24
24
  assert_template :new
25
25
  assert_select 'form[action=/cms-admin/sites]'
26
26
  end
@@ -29,7 +29,7 @@ class CmsAdmin::SitesControllerTest < ActionController::TestCase
29
29
  site = cms_sites(:default)
30
30
  get :edit, :id => site
31
31
  assert_response :success
32
- assert assigns(:cms_site)
32
+ assert assigns(:site)
33
33
  assert_template :edit
34
34
  assert_select "form[action=/cms-admin/sites/#{site.id}]"
35
35
  end
@@ -43,7 +43,7 @@ class CmsAdmin::SitesControllerTest < ActionController::TestCase
43
43
 
44
44
  def test_create
45
45
  assert_difference 'Cms::Site.count' do
46
- post :create, :cms_site => {
46
+ post :create, :site => {
47
47
  :label => 'Test Site',
48
48
  :hostname => 'test.site.local'
49
49
  }
@@ -56,7 +56,7 @@ class CmsAdmin::SitesControllerTest < ActionController::TestCase
56
56
 
57
57
  def test_creation_failure
58
58
  assert_no_difference 'Cms::Site.count' do
59
- post :create, :cms_site => { }
59
+ post :create, :site => { }
60
60
  assert_response :success
61
61
  assert_template :new
62
62
  assert_equal 'Failed to create site', flash[:error]
@@ -65,7 +65,7 @@ class CmsAdmin::SitesControllerTest < ActionController::TestCase
65
65
 
66
66
  def test_update
67
67
  site = cms_sites(:default)
68
- put :update, :id => site, :cms_site => {
68
+ put :update, :id => site, :site => {
69
69
  :label => 'New Site',
70
70
  :hostname => 'new.site.local'
71
71
  }
@@ -79,7 +79,7 @@ class CmsAdmin::SitesControllerTest < ActionController::TestCase
79
79
 
80
80
  def test_update_failure
81
81
  site = cms_sites(:default)
82
- put :update, :id => site, :cms_site => {
82
+ put :update, :id => site, :site => {
83
83
  :hostname => ''
84
84
  }
85
85
  assert_response :success
@@ -3,38 +3,39 @@ require File.expand_path('../../test_helper', File.dirname(__FILE__))
3
3
  class CmsAdmin::SnippetsControllerTest < ActionController::TestCase
4
4
 
5
5
  def test_get_index
6
- get :index
6
+ get :index, :site_id => cms_sites(:default)
7
7
  assert_response :success
8
- assert assigns(:cms_snippets)
8
+ assert assigns(:snippets)
9
9
  assert_template :index
10
10
  end
11
11
 
12
12
  def test_get_index_with_no_snippets
13
13
  Cms::Snippet.delete_all
14
- get :index
14
+ get :index, :site_id => 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_new
20
- get :new
20
+ site = cms_sites(:default)
21
+ get :new, :site_id => site
21
22
  assert_response :success
22
- assert assigns(:cms_snippet)
23
+ assert assigns(:snippet)
23
24
  assert_template :new
24
- assert_select 'form[action=/cms-admin/snippets]'
25
+ assert_select "form[action=/cms-admin/sites/#{site.id}/snippets]"
25
26
  end
26
27
 
27
28
  def test_get_edit
28
29
  snippet = cms_snippets(:default)
29
- get :edit, :id => snippet
30
+ get :edit, :site_id => snippet.site, :id => snippet
30
31
  assert_response :success
31
- assert assigns(:cms_snippet)
32
+ assert assigns(:snippet)
32
33
  assert_template :edit
33
- assert_select "form[action=/cms-admin/snippets/#{snippet.id}]"
34
+ assert_select "form[action=/cms-admin/sites/#{snippet.site.id}/snippets/#{snippet.id}]"
34
35
  end
35
36
 
36
37
  def test_get_edit_failure
37
- get :edit, :id => 'not_found'
38
+ get :edit, :site_id => cms_sites(:default), :id => 'not_found'
38
39
  assert_response :redirect
39
40
  assert_redirected_to :action => :index
40
41
  assert_equal 'Snippet not found', flash[:error]
@@ -42,7 +43,7 @@ class CmsAdmin::SnippetsControllerTest < ActionController::TestCase
42
43
 
43
44
  def test_create
44
45
  assert_difference 'Cms::Snippet.count' do
45
- post :create, :cms_snippet => {
46
+ post :create, :site_id => cms_sites(:default), :snippet => {
46
47
  :label => 'Test Snippet',
47
48
  :slug => 'test-snippet',
48
49
  :content => 'Test Content'
@@ -57,7 +58,7 @@ class CmsAdmin::SnippetsControllerTest < ActionController::TestCase
57
58
 
58
59
  def test_creation_failure
59
60
  assert_no_difference 'Cms::Snippet.count' do
60
- post :create, :cms_snippet => { }
61
+ post :create, :site_id => cms_sites(:default), :snippet => { }
61
62
  assert_response :success
62
63
  assert_template :new
63
64
  assert_equal 'Failed to create snippet', flash[:error]
@@ -66,12 +67,12 @@ class CmsAdmin::SnippetsControllerTest < ActionController::TestCase
66
67
 
67
68
  def test_update
68
69
  snippet = cms_snippets(:default)
69
- put :update, :id => snippet, :cms_snippet => {
70
+ put :update, :site_id => snippet.site, :id => snippet, :snippet => {
70
71
  :label => 'New-Snippet',
71
72
  :content => 'New Content'
72
73
  }
73
74
  assert_response :redirect
74
- assert_redirected_to :action => :edit, :id => snippet
75
+ assert_redirected_to :action => :edit, :site_id => snippet.site, :id => snippet
75
76
  assert_equal 'Snippet updated', flash[:notice]
76
77
  snippet.reload
77
78
  assert_equal 'New-Snippet', snippet.label
@@ -80,7 +81,7 @@ class CmsAdmin::SnippetsControllerTest < ActionController::TestCase
80
81
 
81
82
  def test_update_failure
82
83
  snippet = cms_snippets(:default)
83
- put :update, :id => snippet, :cms_snippet => {
84
+ put :update, :site_id => snippet.site, :id => snippet, :snippet => {
84
85
  :slug => ''
85
86
  }
86
87
  assert_response :success
@@ -92,7 +93,7 @@ class CmsAdmin::SnippetsControllerTest < ActionController::TestCase
92
93
 
93
94
  def test_destroy
94
95
  assert_difference 'Cms::Snippet.count', -1 do
95
- delete :destroy, :id => cms_snippets(:default)
96
+ delete :destroy, :site_id => cms_sites(:default), :id => cms_snippets(:default)
96
97
  assert_response :redirect
97
98
  assert_redirected_to :action => :index
98
99
  assert_equal 'Snippet deleted', flash[:notice]
@@ -4,21 +4,21 @@ class CmsAdmin::UploadsControllerTest < ActionController::TestCase
4
4
 
5
5
  def test_create
6
6
  assert_difference 'Cms::Upload.count', 1 do
7
- xhr :post, :create, :file => fixture_file_upload('files/valid_image.jpg')
7
+ xhr :post, :create, :site_id => cms_sites(:default), :file => fixture_file_upload('files/valid_image.jpg')
8
8
  assert_response :success
9
9
  end
10
10
  end
11
11
 
12
12
  def test_create_failure
13
13
  assert_no_difference 'Cms::Upload.count' do
14
- xhr :post, :create, :file => nil
14
+ xhr :post, :create, :site_id => cms_sites(:default), :file => nil
15
15
  assert_response :bad_request
16
16
  end
17
17
  end
18
18
 
19
19
  def test_destroy
20
20
  assert_difference 'Cms::Upload.count', -1 do
21
- xhr :delete, :destroy, :id => cms_uploads(:default)
21
+ xhr :delete, :destroy, :site_id => cms_sites(:default), :id => cms_uploads(:default)
22
22
  assert_response :success
23
23
  end
24
24
  end
@@ -4,14 +4,14 @@ class AuthenticationTest < ActionDispatch::IntegrationTest
4
4
 
5
5
  def test_get_with_unauthorized_access
6
6
  assert_equal 'ComfortableMexicanSofa::HttpAuth', ComfortableMexicanSofa.config.authentication
7
- get '/cms-admin/pages'
7
+ get '/cms-admin/sites'
8
8
  assert_response :unauthorized
9
9
  get '/'
10
10
  assert_response :success
11
11
  end
12
12
 
13
13
  def test_get_with_authorized_access
14
- http_auth :get, '/cms-admin/pages'
14
+ http_auth :get, '/cms-admin/sites'
15
15
  assert_response :success
16
16
  end
17
17
 
@@ -19,9 +19,9 @@ class AuthenticationTest < ActionDispatch::IntegrationTest
19
19
  assert_equal 'ComfortableMexicanSofa::HttpAuth', ComfortableMexicanSofa.config.authentication
20
20
  ComfortableMexicanSofa::HttpAuth.username = 'newuser'
21
21
  ComfortableMexicanSofa::HttpAuth.password = 'newpass'
22
- http_auth :get, '/cms-admin/pages'
22
+ http_auth :get, '/cms-admin/sites'
23
23
  assert_response :unauthorized
24
- http_auth :get, '/cms-admin/pages', {}, 'newuser', 'newpass'
24
+ http_auth :get, '/cms-admin/sites', {}, 'newuser', 'newpass'
25
25
  assert_response :success
26
26
  end
27
27
  end
@@ -49,7 +49,7 @@ class FixturesTest < ActionDispatch::IntegrationTest
49
49
  assert_difference 'Cms::Page.count', 2 do
50
50
  assert_difference 'Cms::Layout.count', 2 do
51
51
  assert_difference 'Cms::Snippet.count', 1 do
52
- http_auth :get, '/cms-admin/pages'
52
+ http_auth :get, "/cms-admin/sites/#{cms_sites(:default).id}/pages"
53
53
  assert_response :success
54
54
  assert_equal 'CMS Fixtures are enabled. All changes done here will be discarded.', flash[:error]
55
55
  end
@@ -3,12 +3,9 @@ require File.expand_path('../test_helper', File.dirname(__FILE__))
3
3
  class MirrorsTest < ActionDispatch::IntegrationTest
4
4
 
5
5
  def setup
6
- ComfortableMexicanSofa.config.enable_mirror_sites = true
7
- Cms::Site.create!(:hostname => 'test-b.host')
8
- load(File.expand_path('app/models/cms/layout.rb', Rails.root))
9
- load(File.expand_path('app/models/cms/page.rb', Rails.root))
10
- load(File.expand_path('app/models/cms/snippet.rb', Rails.root))
11
-
6
+ @site_a = cms_sites(:default)
7
+ @site_a.update_attribute(:is_mirrored, true)
8
+ @site_b = Cms::Site.create!(:hostname => 'test-b.host', :is_mirrored => true)
12
9
  # making mirrors
13
10
  Cms::Layout.all.each{ |l| l.save! }
14
11
  Cms::Page.all.each{ |p| p.save! }
@@ -16,10 +13,10 @@ class MirrorsTest < ActionDispatch::IntegrationTest
16
13
  end
17
14
 
18
15
  def test_get_layouts
19
- http_auth :get, cms_admin_layouts_path
16
+ http_auth :get, cms_admin_site_layouts_path(@site_a)
20
17
  assert_response :success
21
18
  assert_select 'select#mirror' do
22
- assert_select 'option[value="http://test-b.host/cms-admin/layouts"]'
19
+ assert_select "option[value='/cms-admin/sites/#{@site_b.id}/layouts']"
23
20
  end
24
21
  end
25
22
 
@@ -27,18 +24,18 @@ class MirrorsTest < ActionDispatch::IntegrationTest
27
24
  layout = cms_layouts(:default)
28
25
  assert mirror = layout.mirrors.first
29
26
 
30
- http_auth :get, edit_cms_admin_layout_path(layout)
27
+ http_auth :get, edit_cms_admin_site_layout_path(@site_a, layout)
31
28
  assert_response :success
32
29
  assert_select 'select#mirror' do
33
- assert_select "option[value='http://test-b.host/cms-admin/layouts/#{mirror.id}/edit']"
30
+ assert_select "option[value='/cms-admin/sites/#{@site_b.id}/layouts/#{mirror.id}/edit']"
34
31
  end
35
32
  end
36
33
 
37
34
  def test_get_pages
38
- http_auth :get, cms_admin_pages_path
35
+ http_auth :get, cms_admin_site_pages_path(@site_a)
39
36
  assert_response :success
40
37
  assert_select 'select#mirror' do
41
- assert_select 'option[value="http://test-b.host/cms-admin/pages"]'
38
+ assert_select "option[value='/cms-admin/sites/#{@site_b.id}/pages']"
42
39
  end
43
40
  end
44
41
 
@@ -46,18 +43,18 @@ class MirrorsTest < ActionDispatch::IntegrationTest
46
43
  page = cms_pages(:default)
47
44
  assert mirror = page.mirrors.first
48
45
 
49
- http_auth :get, edit_cms_admin_page_path(page)
46
+ http_auth :get, edit_cms_admin_site_page_path(@site_a, page)
50
47
  assert_response :success
51
48
  assert_select 'select#mirror' do
52
- assert_select "option[value='http://test-b.host/cms-admin/pages/#{mirror.id}/edit']"
49
+ assert_select "option[value='/cms-admin/sites/#{@site_b.id}/pages/#{mirror.id}/edit']"
53
50
  end
54
51
  end
55
52
 
56
53
  def test_get_snippets
57
- http_auth :get, cms_admin_snippets_path
54
+ http_auth :get, cms_admin_site_snippets_path(@site_a)
58
55
  assert_response :success
59
56
  assert_select 'select#mirror' do
60
- assert_select 'option[value="http://test-b.host/cms-admin/snippets"]'
57
+ assert_select "option[value='/cms-admin/sites/#{@site_b.id}/snippets']"
61
58
  end
62
59
  end
63
60
 
@@ -65,10 +62,10 @@ class MirrorsTest < ActionDispatch::IntegrationTest
65
62
  snippet = cms_snippets(:default)
66
63
  assert mirror = snippet.mirrors.first
67
64
 
68
- http_auth :get, edit_cms_admin_snippet_path(snippet)
65
+ http_auth :get, edit_cms_admin_site_snippet_path(@site_a, snippet)
69
66
  assert_response :success
70
67
  assert_select 'select#mirror' do
71
- assert_select "option[value='http://test-b.host/cms-admin/snippets/#{mirror.id}/edit']"
68
+ assert_select "option[value='/cms-admin/sites/#{@site_b.id}/snippets/#{mirror.id}/edit']"
72
69
  end
73
70
  end
74
71
 
@@ -7,37 +7,22 @@ class RoutingExtensionsTest < ActionDispatch::IntegrationTest
7
7
  load(File.expand_path('config/routes.rb', Rails.root))
8
8
  end
9
9
 
10
- def test_get_public_with_content_route_prefix
11
- ComfortableMexicanSofa.config.content_route_prefix = 'custom'
12
- load(File.expand_path('config/routes.rb', Rails.root))
13
-
14
- get '/custom'
15
- assert_response :success
16
- assert assigns(:cms_page)
17
- assert_equal '/', assigns(:cms_page).full_path
18
-
19
- get '/custom/child-page'
20
- assert_response :success
21
- assert assigns(:cms_page)
22
- assert_equal '/child-page', assigns(:cms_page).full_path
23
- end
24
-
25
10
  def test_get_admin_with_admin_route_prefix
26
11
  ComfortableMexicanSofa.config.admin_route_prefix = 'custom-admin'
27
12
  load(File.expand_path('config/routes.rb', Rails.root))
28
13
 
29
- assert_equal '/custom-admin/pages', cms_admin_pages_path
30
- http_auth :get, cms_admin_pages_path
14
+ assert_equal '/custom-admin/sites', cms_admin_sites_path
15
+ http_auth :get, cms_admin_sites_path
31
16
  assert_response :success
32
17
  end
33
18
 
34
19
  def test_get_admin_with_admin_route_redirect
35
- ComfortableMexicanSofa.config.admin_route_redirect = 'snippets'
20
+ ComfortableMexicanSofa.config.admin_route_redirect = '/cms-admin/sites'
36
21
  load(File.expand_path('config/routes.rb', Rails.root))
37
22
 
38
23
  http_auth :get, '/cms-admin'
39
24
  assert_response :redirect
40
- assert_redirected_to cms_admin_snippets_path
25
+ assert_redirected_to cms_admin_sites_path
41
26
  end
42
27
 
43
28
  def test_get_admin_with_admin_route_prefix_disabled