tb_cms 1.3.beta1 → 1.3.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (98) hide show
  1. checksums.yaml +5 -5
  2. data/README.md +0 -9
  3. data/app/assets/javascripts/admin/cms/menu_items.js +12 -6
  4. data/app/assets/javascripts/admin/cms/pages.js +3 -0
  5. data/app/controllers/cms/sitemaps_controller.rb +1 -1
  6. data/app/controllers/pages_controller.rb +4 -4
  7. data/app/helpers/cms/application_helper.rb +4 -4
  8. data/app/models/spud_menu_item.rb +3 -3
  9. data/app/models/spud_page.rb +21 -10
  10. data/app/models/spud_page_partial.rb +3 -20
  11. data/app/models/spud_snippet.rb +1 -4
  12. data/app/views/admin/pages/show.html.erb +12 -15
  13. data/app/views/pages/show.html.erb +2 -2
  14. data/db/migrate/20120101192412_create_spud_pages.rb +1 -1
  15. data/db/migrate/20120101193138_create_spud_menus.rb +1 -1
  16. data/db/migrate/20120101193255_create_spud_menu_items.rb +1 -1
  17. data/db/migrate/20120101194124_create_spud_templates.rb +1 -1
  18. data/db/migrate/20120103034659_create_spud_page_partials.rb +1 -1
  19. data/db/migrate/20120104194032_add_visibility_to_spud_pages.rb +1 -1
  20. data/db/migrate/20120107181337_add_menu_name_to_spud_menu_items.rb +1 -1
  21. data/db/migrate/20120111134754_add_use_custom_url_name_to_spud_pages.rb +1 -1
  22. data/db/migrate/20120118141852_add_notes_to_spud_pages.rb +1 -1
  23. data/db/migrate/20120126232428_add_menu_id_to_spud_menu_items.rb +1 -1
  24. data/db/migrate/20120128163601_add_classes_to_spud_menu_items.rb +1 -1
  25. data/db/migrate/20120329132314_add_site_id_to_spud_pages.rb +1 -1
  26. data/db/migrate/20120329132322_add_site_id_to_spud_templates.rb +1 -1
  27. data/db/migrate/20120329132330_add_site_id_to_spud_menus.rb +1 -1
  28. data/db/migrate/20120510195151_create_spud_page_partial_revisions.rb +1 -1
  29. data/db/migrate/20120911190030_add_symbol_name_to_spud_page_partials.rb +1 -1
  30. data/db/migrate/20120912121313_modify_site_id_for_spud_pages.rb +1 -1
  31. data/db/migrate/20121016233715_add_content_processed_to_spud_page_partials.rb +1 -1
  32. data/db/migrate/20121112151110_add_layout_to_spud_pages.rb +1 -1
  33. data/db/migrate/20121119025608_create_spud_snippets.rb +1 -1
  34. data/db/migrate/20150108162839_remove_site_id_from_cms_tables.rb +1 -1
  35. data/db/migrate/20150622161403_add_title_tag_to_spud_page.rb +1 -1
  36. data/lib/spud_cms/engine.rb +4 -15
  37. data/lib/spud_cms/template_parser.rb +2 -2
  38. data/lib/spud_cms/version.rb +1 -1
  39. data/lib/tb_cms.rb +0 -1
  40. data/spec/controllers/admin/menu_items_controller_spec.rb +18 -18
  41. data/spec/controllers/admin/menus_controller_spec.rb +9 -9
  42. data/spec/controllers/admin/pages_controller_spec.rb +9 -9
  43. data/spec/controllers/pages_controller_spec.rb +5 -5
  44. data/spec/dummy/app/controllers/application_controller.rb +1 -1
  45. data/spec/dummy/config/application.rb +1 -1
  46. data/spec/dummy/config/database.yml +3 -6
  47. data/spec/dummy/config/environments/development.rb +2 -2
  48. data/spec/dummy/db/migrate/20141231214446_create_spud_admin_permissions.tb_core.rb +1 -1
  49. data/spec/dummy/db/migrate/20141231214447_create_spud_users.tb_core.rb +1 -1
  50. data/spec/dummy/db/migrate/20141231214448_add_time_zone_to_spud_user.tb_core.rb +1 -1
  51. data/spec/dummy/db/migrate/20141231214449_add_scope_to_spud_admin_permissions.tb_core.rb +1 -1
  52. data/spec/dummy/db/migrate/20141231214450_create_spud_user_settings.tb_core.rb +1 -1
  53. data/spec/dummy/db/migrate/20141231214451_create_spud_roles.tb_core.rb +1 -1
  54. data/spec/dummy/db/migrate/20141231214452_create_spud_permissions.tb_core.rb +1 -1
  55. data/spec/dummy/db/migrate/20141231214453_create_spud_role_permissions.tb_core.rb +1 -1
  56. data/spec/dummy/db/migrate/20141231214454_drop_spud_admin_permissions.tb_core.rb +1 -1
  57. data/spec/dummy/db/migrate/20141231214455_create_spud_permalinks.tb_permalinks.rb +1 -1
  58. data/spec/dummy/db/migrate/20141231214456_add_site_id_to_spud_permalinks.tb_permalinks.rb +1 -1
  59. data/spec/dummy/db/migrate/20141231214457_modify_site_id_for_spud_permalinks.tb_permalinks.rb +1 -1
  60. data/spec/dummy/db/migrate/20141231214459_create_spud_pages.tb_cms.rb +1 -1
  61. data/spec/dummy/db/migrate/20141231214460_create_spud_menus.tb_cms.rb +1 -1
  62. data/spec/dummy/db/migrate/20141231214461_create_spud_menu_items.tb_cms.rb +1 -1
  63. data/spec/dummy/db/migrate/20141231214462_create_spud_templates.tb_cms.rb +1 -1
  64. data/spec/dummy/db/migrate/20141231214463_create_spud_page_partials.tb_cms.rb +1 -1
  65. data/spec/dummy/db/migrate/20141231214464_add_visibility_to_spud_pages.tb_cms.rb +1 -1
  66. data/spec/dummy/db/migrate/20141231214465_add_menu_name_to_spud_menu_items.tb_cms.rb +1 -1
  67. data/spec/dummy/db/migrate/20141231214466_add_use_custom_url_name_to_spud_pages.tb_cms.rb +1 -1
  68. data/spec/dummy/db/migrate/20141231214467_add_notes_to_spud_pages.tb_cms.rb +1 -1
  69. data/spec/dummy/db/migrate/20141231214468_add_menu_id_to_spud_menu_items.tb_cms.rb +1 -1
  70. data/spec/dummy/db/migrate/20141231214469_add_classes_to_spud_menu_items.tb_cms.rb +1 -1
  71. data/spec/dummy/db/migrate/20141231214470_add_site_id_to_spud_pages.tb_cms.rb +1 -1
  72. data/spec/dummy/db/migrate/20141231214471_add_site_id_to_spud_templates.tb_cms.rb +1 -1
  73. data/spec/dummy/db/migrate/20141231214472_add_site_id_to_spud_menus.tb_cms.rb +1 -1
  74. data/spec/dummy/db/migrate/20141231214473_create_spud_page_partial_revisions.tb_cms.rb +1 -1
  75. data/spec/dummy/db/migrate/20141231214474_add_symbol_name_to_spud_page_partials.tb_cms.rb +1 -1
  76. data/spec/dummy/db/migrate/20141231214475_modify_site_id_for_spud_pages.tb_cms.rb +1 -1
  77. data/spec/dummy/db/migrate/20141231214476_add_content_processed_to_spud_page_partials.tb_cms.rb +1 -1
  78. data/spec/dummy/db/migrate/20141231214477_add_layout_to_spud_pages.tb_cms.rb +1 -1
  79. data/spec/dummy/db/migrate/20141231214479_create_spud_snippets.tb_cms.rb +1 -1
  80. data/spec/dummy/db/migrate/20150108164814_remove_site_id_from_cms_tables.tb_cms.rb +1 -1
  81. data/spec/dummy/db/migrate/20150911185843_add_requires_password_change_to_spud_users.tb_core.rb +1 -1
  82. data/spec/dummy/db/migrate/20150911185844_add_title_tag_to_spud_page.tb_cms.rb +1 -1
  83. data/spec/dummy/db/migrate/20160215180157_create_tb_redirects.tb_redirects.rb +1 -1
  84. data/spec/dummy/db/schema.rb +138 -145
  85. data/spec/helpers/cms/application_helper_spec.rb +37 -37
  86. data/spec/models/spud_menu_item_spec.rb +4 -4
  87. data/spec/models/spud_page_partial_spec.rb +5 -5
  88. data/spec/models/spud_page_spec.rb +20 -12
  89. data/spec/rails_helper.rb +1 -1
  90. metadata +68 -95
  91. data/db/migrate/20121112212113_create_spud_page_liquid_tags.rb +0 -11
  92. data/db/migrate/20121119030136_change_liquid_tags_to_polymorphic.rb +0 -17
  93. data/db/migrate/20140110142037_drop_spud_page_liquid_tags.rb +0 -31
  94. data/lib/spud_cms/liquid_snippet.rb +0 -27
  95. data/spec/dummy/db/migrate/20141231214458_create_tb_liquid_spud_liquid_tags.tb_liquid.rb +0 -13
  96. data/spec/dummy/db/migrate/20141231214478_create_spud_page_liquid_tags.tb_cms.rb +0 -12
  97. data/spec/dummy/db/migrate/20141231214480_change_liquid_tags_to_polymorphic.tb_cms.rb +0 -18
  98. data/spec/dummy/db/migrate/20141231214481_drop_spud_page_liquid_tags.tb_cms.rb +0 -30
@@ -7,48 +7,48 @@ describe Cms::ApplicationHelper, type: :helper do
7
7
 
8
8
  describe '#sp_list_menu' do
9
9
  it 'should be able to find a menu by its name' do
10
- menu = FactoryGirl.create(:spud_menu, name: 'Main')
11
- 2.times { |_x| FactoryGirl.create(:spud_menu_item, parent_id: menu.id, spud_menu_id: menu.id, url: '/') }
10
+ menu = FactoryBot.create(:spud_menu, name: 'Main')
11
+ 2.times { |_x| FactoryBot.create(:spud_menu_item, parent_id: menu.id, spud_menu_id: menu.id, url: '/') }
12
12
 
13
- helper.sp_list_menu(name: 'Main', active_class: 'active')
14
- expect(helper.output_buffer).to match /\<li/
13
+ result = helper.sp_list_menu(name: 'Main', active_class: 'active')
14
+ expect(result).to match /\<li/
15
15
  end
16
16
 
17
17
  it 'should assign id to ul block' do
18
- menu = FactoryGirl.create(:spud_menu)
19
- 2.times { |_x| s = FactoryGirl.create(:spud_menu_item, parent_id: menu.id, spud_menu_id: menu.id, url: '/') }
18
+ menu = FactoryBot.create(:spud_menu)
19
+ 2.times { |_x| s = FactoryBot.create(:spud_menu_item, parent_id: menu.id, spud_menu_id: menu.id, url: '/') }
20
20
 
21
- helper.sp_list_menu(name: menu.name, id: 'nav')
22
- expect(helper.output_buffer).to match /id=\'nav\'/
21
+ result = helper.sp_list_menu(name: menu.name, id: 'nav')
22
+ expect(result).to match /id=\'nav\'/
23
23
  end
24
24
 
25
25
  it 'should render nested menu items' do
26
- menu = FactoryGirl.create(:spud_menu, name: 'Main2')
27
- s = FactoryGirl.create(:spud_menu_item, parent_id: menu.id, spud_menu_id: menu.id, url: '/')
28
- s2 = FactoryGirl.create(:spud_menu_item, parent_id: menu.id, spud_menu_id: menu.id, url: '/')
29
- s3 = FactoryGirl.create(:spud_menu_item, parent_type: 'SpudMenuItem', parent_id: s.id, spud_menu_id: menu.id, url: '/', name: 'SubItem')
26
+ menu = FactoryBot.create(:spud_menu, name: 'Main2')
27
+ s = FactoryBot.create(:spud_menu_item, parent_id: menu.id, spud_menu_id: menu.id, url: '/')
28
+ s2 = FactoryBot.create(:spud_menu_item, parent_id: menu.id, spud_menu_id: menu.id, url: '/')
29
+ s3 = FactoryBot.create(:spud_menu_item, parent_type: 'SpudMenuItem', parent_id: s.id, spud_menu_id: menu.id, url: '/', name: 'SubItem')
30
30
 
31
- helper.sp_list_menu(name: 'Main2')
32
- expect(helper.output_buffer).to match /SubItem/
31
+ result = helper.sp_list_menu(name: 'Main2')
32
+ expect(result).to match /SubItem/
33
33
  end
34
34
 
35
35
  it 'should respect max depth' do
36
- menu = FactoryGirl.create(:spud_menu, name: 'Main4')
37
- s = FactoryGirl.create(:spud_menu_item, parent_id: menu.id, spud_menu_id: menu.id, url: '/')
38
- s2 = FactoryGirl.create(:spud_menu_item, parent_id: menu.id, spud_menu_id: menu.id, url: '/')
39
- s3 = FactoryGirl.create(:spud_menu_item, parent_type: 'SpudMenuItem', parent_id: s.id, spud_menu_id: menu.id, url: '/', name: 'SubItem')
36
+ menu = FactoryBot.create(:spud_menu, name: 'Main4')
37
+ s = FactoryBot.create(:spud_menu_item, parent_id: menu.id, spud_menu_id: menu.id, url: '/')
38
+ s2 = FactoryBot.create(:spud_menu_item, parent_id: menu.id, spud_menu_id: menu.id, url: '/')
39
+ s3 = FactoryBot.create(:spud_menu_item, parent_type: 'SpudMenuItem', parent_id: s.id, spud_menu_id: menu.id, url: '/', name: 'SubItem')
40
40
 
41
- helper.sp_list_menu(name: 'Main4', max_depth: 1)
42
- expect(helper.output_buffer).to_not match /SubItem/
41
+ result = helper.sp_list_menu(name: 'Main4', max_depth: 1)
42
+ expect(result).to_not match /SubItem/
43
43
  end
44
44
  end
45
45
 
46
46
  describe '#sp_menu_with_seperator' do
47
47
  it 'should render a flattened list of links' do
48
- menu = FactoryGirl.create(:spud_menu, name: 'Main3')
49
- s = FactoryGirl.create(:spud_menu_item, parent_id: menu.id, spud_menu_id: menu.id, url: '/')
50
- s2 = FactoryGirl.create(:spud_menu_item, parent_id: menu.id, spud_menu_id: menu.id, url: '/')
51
- s3 = FactoryGirl.create(:spud_menu_item, parent_type: 'SpudMenuItem', parent_id: s.id, spud_menu_id: menu.id, url: '/', name: 'SubItem')
48
+ menu = FactoryBot.create(:spud_menu, name: 'Main3')
49
+ s = FactoryBot.create(:spud_menu_item, parent_id: menu.id, spud_menu_id: menu.id, url: '/')
50
+ s2 = FactoryBot.create(:spud_menu_item, parent_id: menu.id, spud_menu_id: menu.id, url: '/')
51
+ s3 = FactoryBot.create(:spud_menu_item, parent_type: 'SpudMenuItem', parent_id: s.id, spud_menu_id: menu.id, url: '/', name: 'SubItem')
52
52
 
53
53
  content = helper.sp_menu_with_seperator(name: 'Main3')
54
54
  expect(content).to match /SubItem/
@@ -58,9 +58,9 @@ describe Cms::ApplicationHelper, type: :helper do
58
58
 
59
59
  describe '#sp_list_pages' do
60
60
  it 'should be able to list created pages' do
61
- page = FactoryGirl.create(:spud_page)
62
- page2 = FactoryGirl.create(:spud_page)
63
- page3 = FactoryGirl.create(:spud_page, spud_page_id: page.id)
61
+ page = FactoryBot.create(:spud_page)
62
+ page2 = FactoryBot.create(:spud_page)
63
+ page3 = FactoryBot.create(:spud_page, spud_page_id: page.id)
64
64
 
65
65
  content = helper.sp_list_pages(active_class: 'active')
66
66
  expect(content).to match /#{page.name}/
@@ -69,8 +69,8 @@ describe Cms::ApplicationHelper, type: :helper do
69
69
  end
70
70
 
71
71
  it 'should assign id' do
72
- page = FactoryGirl.create(:spud_page)
73
- page2 = FactoryGirl.create(:spud_page)
72
+ page = FactoryBot.create(:spud_page)
73
+ page2 = FactoryBot.create(:spud_page)
74
74
 
75
75
  content = helper.sp_list_pages(id: 'page_nav')
76
76
  expect(content).to match /id=\'page_nav\'/
@@ -78,17 +78,17 @@ describe Cms::ApplicationHelper, type: :helper do
78
78
  end
79
79
 
80
80
  it 'should be able to exclude certain pages' do
81
- page = FactoryGirl.create(:spud_page)
82
- page2 = FactoryGirl.create(:spud_page)
81
+ page = FactoryBot.create(:spud_page)
82
+ page2 = FactoryBot.create(:spud_page)
83
83
 
84
84
  content = helper.sp_list_pages(exclude: [page2.name])
85
85
  expect(content).to match /#{page.name}/
86
86
  expect(content).to_not match /#{page2.name}/
87
87
  end
88
88
  it 'should respect max depth' do
89
- page = FactoryGirl.create(:spud_page)
90
- page2 = FactoryGirl.create(:spud_page)
91
- page3 = FactoryGirl.create(:spud_page, spud_page_id: page.id)
89
+ page = FactoryBot.create(:spud_page)
90
+ page2 = FactoryBot.create(:spud_page)
91
+ page3 = FactoryBot.create(:spud_page, spud_page_id: page.id)
92
92
 
93
93
  content = helper.sp_list_pages(max_depth: 1)
94
94
  expect(content).to match /#{page.name}/
@@ -97,9 +97,9 @@ describe Cms::ApplicationHelper, type: :helper do
97
97
  end
98
98
 
99
99
  it 'should be able to list sub pages of a particular page' do
100
- page = FactoryGirl.create(:spud_page)
101
- page2 = FactoryGirl.create(:spud_page)
102
- page3 = FactoryGirl.create(:spud_page, spud_page_id: page.id)
100
+ page = FactoryBot.create(:spud_page)
101
+ page2 = FactoryBot.create(:spud_page)
102
+ page3 = FactoryBot.create(:spud_page, spud_page_id: page.id)
103
103
  content = helper.sp_list_pages(start_page_id: page.id)
104
104
  expect(content).to_not match /#{page.name}/
105
105
  expect(content).to_not match /#{page2.name}/
@@ -9,22 +9,22 @@ describe SpudMenuItem, type: :model do
9
9
 
10
10
  describe :validations do
11
11
  it 'should require a name' do
12
- p = FactoryGirl.build(:spud_menu_item, name: nil)
12
+ p = FactoryBot.build(:spud_menu_item, name: nil)
13
13
  expect(p).to_not be_valid
14
14
  end
15
15
 
16
16
  it 'should require a menu_id' do
17
- p = FactoryGirl.build(:spud_menu_item, spud_menu_id: nil)
17
+ p = FactoryBot.build(:spud_menu_item, spud_menu_id: nil)
18
18
  expect(p).to_not be_valid
19
19
  end
20
20
 
21
21
  it 'should require a parent_type' do
22
- p = FactoryGirl.build(:spud_menu_item, parent_type: nil)
22
+ p = FactoryBot.build(:spud_menu_item, parent_type: nil)
23
23
  expect(p).to_not be_valid
24
24
  end
25
25
 
26
26
  it 'should require a parent_id' do
27
- p = FactoryGirl.build(:spud_menu_item, parent_id: nil)
27
+ p = FactoryBot.build(:spud_menu_item, parent_id: nil)
28
28
  expect(p).to_not be_valid
29
29
  end
30
30
  end
@@ -4,24 +4,24 @@ describe SpudPagePartial, type: :model do
4
4
  describe 'validations' do
5
5
 
6
6
  it 'should require a name' do
7
- p = FactoryGirl.build(:spud_page_partial, name: nil)
7
+ p = FactoryBot.build(:spud_page_partial, name: nil)
8
8
  expect(p).to_not be_valid
9
9
  end
10
10
 
11
11
  it 'should respond with a symbol_name based on name' do
12
- p = FactoryGirl.build(:spud_page_partial, name: 'Test Page')
12
+ p = FactoryBot.build(:spud_page_partial, name: 'Test Page')
13
13
  expect(p.symbol_name).to eq('test_page')
14
14
  end
15
15
  end
16
16
 
17
17
  describe 'save hooks' do
18
18
  it 'should save the symbol name' do
19
- p = FactoryGirl.create(:spud_page_partial, name: 'Test Page')
19
+ p = FactoryBot.create(:spud_page_partial, name: 'Test Page')
20
20
  expect(p.attributes['symbol_name']).to eq('test_page')
21
21
  end
22
22
 
23
23
  it 'should create a new revision if content is changed' do
24
- p = FactoryGirl.create(:spud_page_partial, name: 'Test Page', content: 'Content')
24
+ p = FactoryBot.create(:spud_page_partial, name: 'Test Page', content: 'Content')
25
25
  expect(SpudPagePartialRevision.where(spud_page_id: p.spud_page_id).count).to eq(1)
26
26
  end
27
27
 
@@ -29,7 +29,7 @@ describe SpudPagePartial, type: :model do
29
29
  Spud::Cms.configure do |config|
30
30
  config.max_revisions = 2
31
31
  end
32
- p = FactoryGirl.create(:spud_page_partial, name: 'Test Page', content: 'Home Sweet Home', spud_page_id: 1)
32
+ p = FactoryBot.create(:spud_page_partial, name: 'Test Page', content: 'Home Sweet Home', spud_page_id: 1)
33
33
  p.content = 'Nah'
34
34
  p.save
35
35
 
@@ -11,26 +11,26 @@ describe SpudPage, type: :model do
11
11
  describe 'validations' do
12
12
 
13
13
  it 'should require a name' do
14
- p = FactoryGirl.build(:spud_page, name: nil)
14
+ p = FactoryBot.build(:spud_page, name: nil)
15
15
  expect(p).to_not be_valid
16
16
  end
17
17
 
18
18
  it 'should require a unique url_name' do
19
- FactoryGirl.create(:spud_page, url_name: 'test', use_custom_url_name: true)
20
- t = FactoryGirl.build(:spud_page, url_name: 'test', use_custom_url_name: true)
19
+ FactoryBot.create(:spud_page, url_name: 'test', use_custom_url_name: true)
20
+ t = FactoryBot.build(:spud_page, url_name: 'test', use_custom_url_name: true)
21
21
  expect(t).to_not be_valid
22
22
  end
23
23
 
24
24
  it 'should generate a url_name if taken' do
25
- FactoryGirl.create(:spud_page, name: 'test')
26
- t = FactoryGirl.build(:spud_page, name: 'test')
25
+ FactoryBot.create(:spud_page, name: 'test')
26
+ t = FactoryBot.build(:spud_page, name: 'test')
27
27
  expect do
28
28
  t.valid?
29
29
  end.to change(t, :url_name)
30
30
  end
31
31
 
32
32
  it 'should dependantly destroy page_partials' do
33
- t = FactoryGirl.create(:spud_page, spud_page_partials: [SpudPagePartial.new(name: 'body')])
33
+ t = FactoryBot.create(:spud_page, spud_page_partials: [SpudPagePartial.new(name: 'body')])
34
34
  expect do
35
35
  t.destroy
36
36
  end.to change(SpudPagePartial, :count).from(1).to(0)
@@ -53,7 +53,7 @@ describe SpudPage, type: :model do
53
53
  end
54
54
 
55
55
  it 'should return private if visibility is == 1' do
56
- parent_page = FactoryGirl.build(:spud_page, name: 'parent', visibility: 1)
56
+ parent_page = FactoryBot.build(:spud_page, name: 'parent', visibility: 1)
57
57
 
58
58
  expect(parent_page.is_private?).to eq(true)
59
59
 
@@ -64,25 +64,25 @@ describe SpudPage, type: :model do
64
64
 
65
65
  describe '#generate_url_name' do
66
66
  it 'should use the provided url' do
67
- @page = FactoryGirl.create(:spud_page, url_name: 'test')
67
+ @page = FactoryBot.create(:spud_page, url_name: 'test')
68
68
  expect(@page.url_name).to eq('test')
69
69
  end
70
70
 
71
71
  it 'should generate a url based on the page name' do
72
- @page = FactoryGirl.create(:spud_page, name: 'Hello World')
72
+ @page = FactoryBot.create(:spud_page, name: 'Hello World')
73
73
  expect(@page.url_name).to eq('hello-world')
74
74
  end
75
75
 
76
76
  it 'should generate a url based on the page name and parent page' do
77
- @parent = FactoryGirl.create(:spud_page, name: 'About Us')
78
- @page = FactoryGirl.create(:spud_page, name: 'Hello World', spud_page: @parent)
77
+ @parent = FactoryBot.create(:spud_page, name: 'About Us')
78
+ @page = FactoryBot.create(:spud_page, name: 'Hello World', spud_page: @parent)
79
79
  expect(@page.url_name).to eq('about-us/hello-world')
80
80
  end
81
81
  end
82
82
 
83
83
  describe '#create_redirect_if_necessary' do
84
84
  it 'should create a redirect' do
85
- page = FactoryGirl.create(:spud_page, url_name: 'page-a')
85
+ page = FactoryBot.create(:spud_page, url_name: 'page-a')
86
86
  expect do
87
87
  page.update(url_name: 'page-b')
88
88
  end.to change(page.tb_redirects, :count).by(1)
@@ -92,4 +92,12 @@ describe SpudPage, type: :model do
92
92
  end
93
93
  end
94
94
 
95
+ describe '.find_ignoring_case' do
96
+ it 'finds the page ignoring case' do
97
+ page = FactoryBot.create(:spud_page, url_name: 'HEy-guyS-lETS-Mix-CAsE')
98
+ found = SpudPage.find_ignoring_case('hey-guys-lets-mix-case')
99
+ expect(page).to eq(found)
100
+ end
101
+ end
102
+
95
103
  end
@@ -7,7 +7,7 @@ require 'rspec/rails'
7
7
  require 'rails-controller-testing'
8
8
  require 'database_cleaner'
9
9
  require 'simplecov'
10
- require 'factory_girl_rails'
10
+ require 'factory_bot_rails'
11
11
  require 'tb_core/test_helper'
12
12
  require 'shoulda'
13
13
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tb_cms
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.beta1
4
+ version: 1.3.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Moser Consulting
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-10-21 00:00:00.000000000 Z
11
+ date: 2020-07-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -16,28 +16,28 @@ dependencies:
16
16
  requirements:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: 5.0.0.1
19
+ version: 5.1.3
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - ">="
25
25
  - !ruby/object:Gem::Version
26
- version: 5.0.0.1
26
+ version: 5.1.3
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: tb_core
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - ">="
32
32
  - !ruby/object:Gem::Version
33
- version: 1.4.beta2
33
+ version: 1.4.4
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - ">="
39
39
  - !ruby/object:Gem::Version
40
- version: 1.4.beta2
40
+ version: 1.4.4
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: tb_redirects
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -53,33 +53,19 @@ dependencies:
53
53
  - !ruby/object:Gem::Version
54
54
  version: 1.0.beta1
55
55
  - !ruby/object:Gem::Dependency
56
- name: tb_liquid
56
+ name: pg
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - ">="
60
- - !ruby/object:Gem::Version
61
- version: 1.1.beta1
62
- type: :runtime
63
- prerelease: false
64
- version_requirements: !ruby/object:Gem::Requirement
65
- requirements:
66
- - - ">="
67
- - !ruby/object:Gem::Version
68
- version: 1.1.beta1
69
- - !ruby/object:Gem::Dependency
70
- name: mysql2
71
- requirement: !ruby/object:Gem::Requirement
72
- requirements:
73
- - - ">="
59
+ - - "~>"
74
60
  - !ruby/object:Gem::Version
75
- version: '0'
61
+ version: '0.18'
76
62
  type: :development
77
63
  prerelease: false
78
64
  version_requirements: !ruby/object:Gem::Requirement
79
65
  requirements:
80
- - - ">="
66
+ - - "~>"
81
67
  - !ruby/object:Gem::Version
82
- version: '0'
68
+ version: '0.18'
83
69
  - !ruby/object:Gem::Dependency
84
70
  name: rspec-rails
85
71
  requirement: !ruby/object:Gem::Requirement
@@ -109,7 +95,7 @@ dependencies:
109
95
  - !ruby/object:Gem::Version
110
96
  version: '0'
111
97
  - !ruby/object:Gem::Dependency
112
- name: factory_girl_rails
98
+ name: factory_bot_rails
113
99
  requirement: !ruby/object:Gem::Requirement
114
100
  requirements:
115
101
  - - ">="
@@ -240,10 +226,7 @@ files:
240
226
  - db/migrate/20120912121313_modify_site_id_for_spud_pages.rb
241
227
  - db/migrate/20121016233715_add_content_processed_to_spud_page_partials.rb
242
228
  - db/migrate/20121112151110_add_layout_to_spud_pages.rb
243
- - db/migrate/20121112212113_create_spud_page_liquid_tags.rb
244
229
  - db/migrate/20121119025608_create_spud_snippets.rb
245
- - db/migrate/20121119030136_change_liquid_tags_to_polymorphic.rb
246
- - db/migrate/20140110142037_drop_spud_page_liquid_tags.rb
247
230
  - db/migrate/20150108162839_remove_site_id_from_cms_tables.rb
248
231
  - db/migrate/20150622161403_add_title_tag_to_spud_page.rb
249
232
  - lib/generators/spud/cms/layout_generator.rb
@@ -251,7 +234,6 @@ files:
251
234
  - lib/generators/spud/cms/templates/layout_actions.rb
252
235
  - lib/spud_cms/configuration.rb
253
236
  - lib/spud_cms/engine.rb
254
- - lib/spud_cms/liquid_snippet.rb
255
237
  - lib/spud_cms/page_route.rb
256
238
  - lib/spud_cms/template_parser.rb
257
239
  - lib/spud_cms/test_files.rb
@@ -299,7 +281,6 @@ files:
299
281
  - spec/dummy/db/migrate/20141231214455_create_spud_permalinks.tb_permalinks.rb
300
282
  - spec/dummy/db/migrate/20141231214456_add_site_id_to_spud_permalinks.tb_permalinks.rb
301
283
  - spec/dummy/db/migrate/20141231214457_modify_site_id_for_spud_permalinks.tb_permalinks.rb
302
- - spec/dummy/db/migrate/20141231214458_create_tb_liquid_spud_liquid_tags.tb_liquid.rb
303
284
  - spec/dummy/db/migrate/20141231214459_create_spud_pages.tb_cms.rb
304
285
  - spec/dummy/db/migrate/20141231214460_create_spud_menus.tb_cms.rb
305
286
  - spec/dummy/db/migrate/20141231214461_create_spud_menu_items.tb_cms.rb
@@ -319,10 +300,7 @@ files:
319
300
  - spec/dummy/db/migrate/20141231214475_modify_site_id_for_spud_pages.tb_cms.rb
320
301
  - spec/dummy/db/migrate/20141231214476_add_content_processed_to_spud_page_partials.tb_cms.rb
321
302
  - spec/dummy/db/migrate/20141231214477_add_layout_to_spud_pages.tb_cms.rb
322
- - spec/dummy/db/migrate/20141231214478_create_spud_page_liquid_tags.tb_cms.rb
323
303
  - spec/dummy/db/migrate/20141231214479_create_spud_snippets.tb_cms.rb
324
- - spec/dummy/db/migrate/20141231214480_change_liquid_tags_to_polymorphic.tb_cms.rb
325
- - spec/dummy/db/migrate/20141231214481_drop_spud_page_liquid_tags.tb_cms.rb
326
304
  - spec/dummy/db/migrate/20150108164814_remove_site_id_from_cms_tables.tb_cms.rb
327
305
  - spec/dummy/db/migrate/20150911185843_add_requires_password_change_to_spud_users.tb_core.rb
328
306
  - spec/dummy/db/migrate/20150911185844_add_title_tag_to_spud_page.tb_cms.rb
@@ -355,96 +333,91 @@ required_ruby_version: !ruby/object:Gem::Requirement
355
333
  version: '0'
356
334
  required_rubygems_version: !ruby/object:Gem::Requirement
357
335
  requirements:
358
- - - ">"
336
+ - - ">="
359
337
  - !ruby/object:Gem::Version
360
- version: 1.3.1
338
+ version: '0'
361
339
  requirements: []
362
- rubyforge_project:
363
- rubygems_version: 2.5.1
340
+ rubygems_version: 3.0.8
364
341
  signing_key:
365
342
  specification_version: 4
366
343
  summary: Twice Baked CMS
367
344
  test_files:
368
- - spec/controllers/admin/menu_items_controller_spec.rb
369
- - spec/controllers/admin/menus_controller_spec.rb
370
- - spec/controllers/admin/pages_controller_spec.rb
371
- - spec/controllers/admin/snippets_controller_spec.rb
372
- - spec/controllers/pages_controller_spec.rb
345
+ - spec/spec_helper.rb
346
+ - spec/dummy/app/controllers/application_controller.rb
347
+ - spec/dummy/app/views/layouts/content_left.html.erb
348
+ - spec/dummy/app/views/layouts/application.html.erb
373
349
  - spec/dummy/app/assets/javascripts/application.js
374
350
  - spec/dummy/app/assets/stylesheets/application.css
375
- - spec/dummy/app/controllers/application_controller.rb
376
351
  - spec/dummy/app/helpers/application_helper.rb
377
- - spec/dummy/app/views/layouts/application.html.erb
378
- - spec/dummy/app/views/layouts/content_left.html.erb
379
- - spec/dummy/config/application.rb
380
- - spec/dummy/config/boot.rb
381
- - spec/dummy/config/database.yml
382
- - spec/dummy/config/environment.rb
383
- - spec/dummy/config/environments/development.rb
352
+ - spec/dummy/config/routes.rb
353
+ - spec/dummy/config/locales/en.yml
384
354
  - spec/dummy/config/environments/production.rb
355
+ - spec/dummy/config/environments/development.rb
385
356
  - spec/dummy/config/environments/test.rb
357
+ - spec/dummy/config/environment.rb
358
+ - spec/dummy/config/application.rb
359
+ - spec/dummy/config/database.yml
360
+ - spec/dummy/config/boot.rb
386
361
  - spec/dummy/config/initializers/backtrace_silencers.rb
387
- - spec/dummy/config/initializers/inflections.rb
388
362
  - spec/dummy/config/initializers/mime_types.rb
389
- - spec/dummy/config/initializers/secret_token.rb
390
363
  - spec/dummy/config/initializers/session_store.rb
391
364
  - spec/dummy/config/initializers/wrap_parameters.rb
392
- - spec/dummy/config/locales/en.yml
393
- - spec/dummy/config/routes.rb
365
+ - spec/dummy/config/initializers/secret_token.rb
366
+ - spec/dummy/config/initializers/inflections.rb
394
367
  - spec/dummy/config.ru
395
- - spec/dummy/db/migrate/20141231214446_create_spud_admin_permissions.tb_core.rb
396
- - spec/dummy/db/migrate/20141231214447_create_spud_users.tb_core.rb
368
+ - spec/dummy/script/rails
369
+ - spec/dummy/Rakefile
370
+ - spec/dummy/public/favicon.ico
371
+ - spec/dummy/public/422.html
372
+ - spec/dummy/public/500.html
373
+ - spec/dummy/public/404.html
374
+ - spec/dummy/db/schema.rb
397
375
  - spec/dummy/db/migrate/20141231214448_add_time_zone_to_spud_user.tb_core.rb
398
- - spec/dummy/db/migrate/20141231214449_add_scope_to_spud_admin_permissions.tb_core.rb
399
- - spec/dummy/db/migrate/20141231214450_create_spud_user_settings.tb_core.rb
400
- - spec/dummy/db/migrate/20141231214451_create_spud_roles.tb_core.rb
401
- - spec/dummy/db/migrate/20141231214452_create_spud_permissions.tb_core.rb
402
- - spec/dummy/db/migrate/20141231214453_create_spud_role_permissions.tb_core.rb
403
376
  - spec/dummy/db/migrate/20141231214454_drop_spud_admin_permissions.tb_core.rb
404
- - spec/dummy/db/migrate/20141231214455_create_spud_permalinks.tb_permalinks.rb
405
- - spec/dummy/db/migrate/20141231214456_add_site_id_to_spud_permalinks.tb_permalinks.rb
406
- - spec/dummy/db/migrate/20141231214457_modify_site_id_for_spud_permalinks.tb_permalinks.rb
407
- - spec/dummy/db/migrate/20141231214458_create_tb_liquid_spud_liquid_tags.tb_liquid.rb
377
+ - spec/dummy/db/migrate/20141231214451_create_spud_roles.tb_core.rb
378
+ - spec/dummy/db/migrate/20150108164814_remove_site_id_from_cms_tables.tb_cms.rb
379
+ - spec/dummy/db/migrate/20141231214469_add_classes_to_spud_menu_items.tb_cms.rb
408
380
  - spec/dummy/db/migrate/20141231214459_create_spud_pages.tb_cms.rb
381
+ - spec/dummy/db/migrate/20141231214477_add_layout_to_spud_pages.tb_cms.rb
382
+ - spec/dummy/db/migrate/20141231214464_add_visibility_to_spud_pages.tb_cms.rb
383
+ - spec/dummy/db/migrate/20141231214473_create_spud_page_partial_revisions.tb_cms.rb
384
+ - spec/dummy/db/migrate/20141231214470_add_site_id_to_spud_pages.tb_cms.rb
385
+ - spec/dummy/db/migrate/20141231214447_create_spud_users.tb_core.rb
409
386
  - spec/dummy/db/migrate/20141231214460_create_spud_menus.tb_cms.rb
410
- - spec/dummy/db/migrate/20141231214461_create_spud_menu_items.tb_cms.rb
411
- - spec/dummy/db/migrate/20141231214462_create_spud_templates.tb_cms.rb
387
+ - spec/dummy/db/migrate/20141231214450_create_spud_user_settings.tb_core.rb
388
+ - spec/dummy/db/migrate/20141231214476_add_content_processed_to_spud_page_partials.tb_cms.rb
412
389
  - spec/dummy/db/migrate/20141231214463_create_spud_page_partials.tb_cms.rb
413
- - spec/dummy/db/migrate/20141231214464_add_visibility_to_spud_pages.tb_cms.rb
414
- - spec/dummy/db/migrate/20141231214465_add_menu_name_to_spud_menu_items.tb_cms.rb
415
- - spec/dummy/db/migrate/20141231214466_add_use_custom_url_name_to_spud_pages.tb_cms.rb
390
+ - spec/dummy/db/migrate/20141231214449_add_scope_to_spud_admin_permissions.tb_core.rb
416
391
  - spec/dummy/db/migrate/20141231214467_add_notes_to_spud_pages.tb_cms.rb
417
- - spec/dummy/db/migrate/20141231214468_add_menu_id_to_spud_menu_items.tb_cms.rb
418
- - spec/dummy/db/migrate/20141231214469_add_classes_to_spud_menu_items.tb_cms.rb
419
- - spec/dummy/db/migrate/20141231214470_add_site_id_to_spud_pages.tb_cms.rb
420
- - spec/dummy/db/migrate/20141231214471_add_site_id_to_spud_templates.tb_cms.rb
392
+ - spec/dummy/db/migrate/20141231214446_create_spud_admin_permissions.tb_core.rb
393
+ - spec/dummy/db/migrate/20160215180157_create_tb_redirects.tb_redirects.rb
421
394
  - spec/dummy/db/migrate/20141231214472_add_site_id_to_spud_menus.tb_cms.rb
422
- - spec/dummy/db/migrate/20141231214473_create_spud_page_partial_revisions.tb_cms.rb
423
- - spec/dummy/db/migrate/20141231214474_add_symbol_name_to_spud_page_partials.tb_cms.rb
395
+ - spec/dummy/db/migrate/20141231214465_add_menu_name_to_spud_menu_items.tb_cms.rb
396
+ - spec/dummy/db/migrate/20141231214452_create_spud_permissions.tb_core.rb
397
+ - spec/dummy/db/migrate/20141231214453_create_spud_role_permissions.tb_core.rb
424
398
  - spec/dummy/db/migrate/20141231214475_modify_site_id_for_spud_pages.tb_cms.rb
425
- - spec/dummy/db/migrate/20141231214476_add_content_processed_to_spud_page_partials.tb_cms.rb
426
- - spec/dummy/db/migrate/20141231214477_add_layout_to_spud_pages.tb_cms.rb
427
- - spec/dummy/db/migrate/20141231214478_create_spud_page_liquid_tags.tb_cms.rb
399
+ - spec/dummy/db/migrate/20141231214461_create_spud_menu_items.tb_cms.rb
400
+ - spec/dummy/db/migrate/20141231214457_modify_site_id_for_spud_permalinks.tb_permalinks.rb
401
+ - spec/dummy/db/migrate/20141231214455_create_spud_permalinks.tb_permalinks.rb
402
+ - spec/dummy/db/migrate/20141231214466_add_use_custom_url_name_to_spud_pages.tb_cms.rb
403
+ - spec/dummy/db/migrate/20141231214468_add_menu_id_to_spud_menu_items.tb_cms.rb
428
404
  - spec/dummy/db/migrate/20141231214479_create_spud_snippets.tb_cms.rb
429
- - spec/dummy/db/migrate/20141231214480_change_liquid_tags_to_polymorphic.tb_cms.rb
430
- - spec/dummy/db/migrate/20141231214481_drop_spud_page_liquid_tags.tb_cms.rb
431
- - spec/dummy/db/migrate/20150108164814_remove_site_id_from_cms_tables.tb_cms.rb
432
- - spec/dummy/db/migrate/20150911185843_add_requires_password_change_to_spud_users.tb_core.rb
405
+ - spec/dummy/db/migrate/20141231214471_add_site_id_to_spud_templates.tb_cms.rb
433
406
  - spec/dummy/db/migrate/20150911185844_add_title_tag_to_spud_page.tb_cms.rb
434
- - spec/dummy/db/migrate/20160215180157_create_tb_redirects.tb_redirects.rb
435
- - spec/dummy/db/schema.rb
436
- - spec/dummy/public/404.html
437
- - spec/dummy/public/422.html
438
- - spec/dummy/public/500.html
439
- - spec/dummy/public/favicon.ico
440
- - spec/dummy/Rakefile
407
+ - spec/dummy/db/migrate/20141231214462_create_spud_templates.tb_cms.rb
408
+ - spec/dummy/db/migrate/20141231214456_add_site_id_to_spud_permalinks.tb_permalinks.rb
409
+ - spec/dummy/db/migrate/20150911185843_add_requires_password_change_to_spud_users.tb_core.rb
410
+ - spec/dummy/db/migrate/20141231214474_add_symbol_name_to_spud_page_partials.tb_cms.rb
441
411
  - spec/dummy/README.rdoc
442
- - spec/dummy/script/rails
443
- - spec/helpers/cms/application_helper_spec.rb
444
- - spec/models/spud_menu_item_spec.rb
445
412
  - spec/models/spud_page_partial_revision_spec.rb
446
413
  - spec/models/spud_page_partial_spec.rb
447
414
  - spec/models/spud_page_spec.rb
415
+ - spec/models/spud_menu_item_spec.rb
448
416
  - spec/models/spud_snippet_spec.rb
417
+ - spec/controllers/pages_controller_spec.rb
418
+ - spec/controllers/admin/snippets_controller_spec.rb
419
+ - spec/controllers/admin/pages_controller_spec.rb
420
+ - spec/controllers/admin/menu_items_controller_spec.rb
421
+ - spec/controllers/admin/menus_controller_spec.rb
449
422
  - spec/rails_helper.rb
450
- - spec/spec_helper.rb
423
+ - spec/helpers/cms/application_helper_spec.rb