tb_cms 1.2.0.beta1 → 1.2.0.beta3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (76) hide show
  1. checksums.yaml +4 -4
  2. data/app/controllers/admin/menu_items_controller.rb +0 -3
  3. data/app/controllers/admin/menus_controller.rb +1 -6
  4. data/app/controllers/admin/pages_controller.rb +3 -7
  5. data/app/controllers/admin/snippets_controller.rb +0 -4
  6. data/app/controllers/cms/sitemaps_controller.rb +0 -4
  7. data/app/controllers/pages_controller.rb +3 -34
  8. data/app/helpers/cms/application_helper.rb +2 -18
  9. data/app/models/concerns/cms_deprecated_multisite.rb +21 -0
  10. data/app/models/spud_menu.rb +3 -3
  11. data/app/models/spud_page.rb +12 -20
  12. data/app/models/spud_snippet.rb +2 -3
  13. data/app/views/admin/menu_items/_form.html.erb +1 -1
  14. data/app/views/admin/pages/_form.html.erb +1 -1
  15. data/db/migrate/20121119030136_change_liquid_tags_to_polymorphic.rb +1 -3
  16. data/db/migrate/20150108162839_remove_site_id_from_cms_tables.rb +12 -0
  17. data/lib/spud_cms/engine.rb +0 -4
  18. data/lib/spud_cms/template_parser.rb +2 -30
  19. data/lib/spud_cms/version.rb +1 -1
  20. data/spec/{support/authlogic_helper.rb → authlogic_helper.rb} +1 -1
  21. data/spec/controllers/admin/menu_items_controller_spec.rb +28 -59
  22. data/spec/controllers/admin/menus_controller_spec.rb +32 -54
  23. data/spec/controllers/admin/pages_controller_spec.rb +26 -43
  24. data/spec/controllers/admin/snippets_controller_spec.rb +2 -2
  25. data/spec/controllers/pages_controller_spec.rb +11 -63
  26. data/spec/dummy/config/application.rb +5 -0
  27. data/spec/dummy/config/environments/production.rb +1 -1
  28. data/spec/dummy/config/environments/test.rb +1 -1
  29. data/spec/dummy/db/migrate/{20140110051458_create_spud_liquid_tags.tb_core.rb → 20141231214458_create_tb_liquid_spud_liquid_tags.tb_liquid.rb} +2 -2
  30. data/spec/dummy/db/migrate/{20140110051483_change_liquid_tags_to_polymorphic.tb_cms.rb → 20141231214480_change_liquid_tags_to_polymorphic.tb_cms.rb} +1 -3
  31. data/spec/dummy/db/migrate/{20140110051484_drop_spud_page_liquid_tags.tb_cms.rb → 20141231214481_drop_spud_page_liquid_tags.tb_cms.rb} +10 -8
  32. data/spec/dummy/db/migrate/20150108164814_remove_site_id_from_cms_tables.tb_cms.rb +13 -0
  33. data/spec/dummy/db/schema.rb +85 -93
  34. data/spec/helpers/cms/application_helper_spec.rb +23 -74
  35. data/spec/models/spud_menu_item_spec.rb +6 -6
  36. data/spec/models/spud_page_partial_revision_spec.rb +2 -2
  37. data/spec/models/spud_page_partial_spec.rb +9 -9
  38. data/spec/models/spud_page_spec.rb +20 -44
  39. data/spec/models/spud_snippet_spec.rb +2 -2
  40. data/spec/rails_helper.rb +72 -0
  41. data/spec/spec_helper.rb +77 -32
  42. metadata +104 -142
  43. data/spec/controllers/cms/sitemaps_controller_spec.rb +0 -41
  44. /data/spec/dummy/db/migrate/{20140110051449_create_spud_admin_permissions.tb_core.rb → 20141231214446_create_spud_admin_permissions.tb_core.rb} +0 -0
  45. /data/spec/dummy/db/migrate/{20140110051450_create_spud_users.tb_core.rb → 20141231214447_create_spud_users.tb_core.rb} +0 -0
  46. /data/spec/dummy/db/migrate/{20140110051451_add_time_zone_to_spud_user.tb_core.rb → 20141231214448_add_time_zone_to_spud_user.tb_core.rb} +0 -0
  47. /data/spec/dummy/db/migrate/{20140110051452_add_scope_to_spud_admin_permissions.tb_core.rb → 20141231214449_add_scope_to_spud_admin_permissions.tb_core.rb} +0 -0
  48. /data/spec/dummy/db/migrate/{20140110051453_create_spud_user_settings.tb_core.rb → 20141231214450_create_spud_user_settings.tb_core.rb} +0 -0
  49. /data/spec/dummy/db/migrate/{20140110051454_create_spud_roles.tb_core.rb → 20141231214451_create_spud_roles.tb_core.rb} +0 -0
  50. /data/spec/dummy/db/migrate/{20140110051455_create_spud_permissions.tb_core.rb → 20141231214452_create_spud_permissions.tb_core.rb} +0 -0
  51. /data/spec/dummy/db/migrate/{20140110051456_create_spud_role_permissions.tb_core.rb → 20141231214453_create_spud_role_permissions.tb_core.rb} +0 -0
  52. /data/spec/dummy/db/migrate/{20140110051457_drop_spud_admin_permissions.tb_core.rb → 20141231214454_drop_spud_admin_permissions.tb_core.rb} +0 -0
  53. /data/spec/dummy/db/migrate/{20140110051459_create_spud_permalinks.tb_permalinks.rb → 20141231214455_create_spud_permalinks.tb_permalinks.rb} +0 -0
  54. /data/spec/dummy/db/migrate/{20140110051460_add_site_id_to_spud_permalinks.tb_permalinks.rb → 20141231214456_add_site_id_to_spud_permalinks.tb_permalinks.rb} +0 -0
  55. /data/spec/dummy/db/migrate/{20140110051461_modify_site_id_for_spud_permalinks.tb_permalinks.rb → 20141231214457_modify_site_id_for_spud_permalinks.tb_permalinks.rb} +0 -0
  56. /data/spec/dummy/db/migrate/{20140110051462_create_spud_pages.tb_cms.rb → 20141231214459_create_spud_pages.tb_cms.rb} +0 -0
  57. /data/spec/dummy/db/migrate/{20140110051463_create_spud_menus.tb_cms.rb → 20141231214460_create_spud_menus.tb_cms.rb} +0 -0
  58. /data/spec/dummy/db/migrate/{20140110051464_create_spud_menu_items.tb_cms.rb → 20141231214461_create_spud_menu_items.tb_cms.rb} +0 -0
  59. /data/spec/dummy/db/migrate/{20140110051465_create_spud_templates.tb_cms.rb → 20141231214462_create_spud_templates.tb_cms.rb} +0 -0
  60. /data/spec/dummy/db/migrate/{20140110051466_create_spud_page_partials.tb_cms.rb → 20141231214463_create_spud_page_partials.tb_cms.rb} +0 -0
  61. /data/spec/dummy/db/migrate/{20140110051467_add_visibility_to_spud_pages.tb_cms.rb → 20141231214464_add_visibility_to_spud_pages.tb_cms.rb} +0 -0
  62. /data/spec/dummy/db/migrate/{20140110051468_add_menu_name_to_spud_menu_items.tb_cms.rb → 20141231214465_add_menu_name_to_spud_menu_items.tb_cms.rb} +0 -0
  63. /data/spec/dummy/db/migrate/{20140110051469_add_use_custom_url_name_to_spud_pages.tb_cms.rb → 20141231214466_add_use_custom_url_name_to_spud_pages.tb_cms.rb} +0 -0
  64. /data/spec/dummy/db/migrate/{20140110051470_add_notes_to_spud_pages.tb_cms.rb → 20141231214467_add_notes_to_spud_pages.tb_cms.rb} +0 -0
  65. /data/spec/dummy/db/migrate/{20140110051471_add_menu_id_to_spud_menu_items.tb_cms.rb → 20141231214468_add_menu_id_to_spud_menu_items.tb_cms.rb} +0 -0
  66. /data/spec/dummy/db/migrate/{20140110051472_add_classes_to_spud_menu_items.tb_cms.rb → 20141231214469_add_classes_to_spud_menu_items.tb_cms.rb} +0 -0
  67. /data/spec/dummy/db/migrate/{20140110051473_add_site_id_to_spud_pages.tb_cms.rb → 20141231214470_add_site_id_to_spud_pages.tb_cms.rb} +0 -0
  68. /data/spec/dummy/db/migrate/{20140110051474_add_site_id_to_spud_templates.tb_cms.rb → 20141231214471_add_site_id_to_spud_templates.tb_cms.rb} +0 -0
  69. /data/spec/dummy/db/migrate/{20140110051475_add_site_id_to_spud_menus.tb_cms.rb → 20141231214472_add_site_id_to_spud_menus.tb_cms.rb} +0 -0
  70. /data/spec/dummy/db/migrate/{20140110051476_create_spud_page_partial_revisions.tb_cms.rb → 20141231214473_create_spud_page_partial_revisions.tb_cms.rb} +0 -0
  71. /data/spec/dummy/db/migrate/{20140110051477_add_symbol_name_to_spud_page_partials.tb_cms.rb → 20141231214474_add_symbol_name_to_spud_page_partials.tb_cms.rb} +0 -0
  72. /data/spec/dummy/db/migrate/{20140110051478_modify_site_id_for_spud_pages.tb_cms.rb → 20141231214475_modify_site_id_for_spud_pages.tb_cms.rb} +0 -0
  73. /data/spec/dummy/db/migrate/{20140110051479_add_content_processed_to_spud_page_partials.tb_cms.rb → 20141231214476_add_content_processed_to_spud_page_partials.tb_cms.rb} +0 -0
  74. /data/spec/dummy/db/migrate/{20140110051480_add_layout_to_spud_pages.tb_cms.rb → 20141231214477_add_layout_to_spud_pages.tb_cms.rb} +0 -0
  75. /data/spec/dummy/db/migrate/{20140110051481_create_spud_page_liquid_tags.tb_cms.rb → 20141231214478_create_spud_page_liquid_tags.tb_cms.rb} +0 -0
  76. /data/spec/dummy/db/migrate/{20140110051482_create_spud_snippets.tb_cms.rb → 20141231214479_create_spud_snippets.tb_cms.rb} +0 -0
@@ -1,17 +1,19 @@
1
- # This migration comes from tb_cms (originally 20140110041105)
1
+ # This migration comes from tb_cms (originally 20140110142037)
2
2
  class DropSpudPageLiquidTags < ActiveRecord::Migration
3
3
 
4
4
  class SpudPageLiquidTag < ActiveRecord::Base
5
5
  end
6
6
 
7
7
  def up
8
- SpudPageLiquidTag.all.each do |tag|
9
- SpudLiquidTag.create({
10
- :attachment_id => tag.attachment_id,
11
- :attachment_type => tag.attachment_type,
12
- :tag_name => tag.tag_name,
13
- :value => tag.value
14
- })
8
+ if defined?(SpudLiquidTag)
9
+ SpudPageLiquidTag.all.each do |tag|
10
+ SpudLiquidTag.create({
11
+ :attachment_id => tag.attachment_id,
12
+ :attachment_type => tag.attachment_type,
13
+ :tag_name => tag.tag_name,
14
+ :value => tag.value
15
+ })
16
+ end
15
17
  end
16
18
  drop_table :spud_page_liquid_tags
17
19
  end
@@ -0,0 +1,13 @@
1
+ # This migration comes from tb_cms (originally 20150108162839)
2
+ class RemoveSiteIdFromCmsTables < ActiveRecord::Migration
3
+ def up
4
+ remove_column :spud_menus, :site_id
5
+ remove_column :spud_pages, :site_id
6
+ remove_column :spud_snippets, :site_id
7
+ end
8
+ def down
9
+ add_column :spud_menus, :site_id, :integer
10
+ add_column :spud_pages, :site_id, :integer
11
+ add_column :spud_snippets, :site_id, :integer
12
+ end
13
+ end
@@ -11,118 +11,112 @@
11
11
  #
12
12
  # It's strongly recommended that you check this file into your version control system.
13
13
 
14
- ActiveRecord::Schema.define(version: 20140110051484) do
14
+ ActiveRecord::Schema.define(version: 20150108164814) do
15
15
 
16
- create_table "spud_liquid_tags", force: true do |t|
17
- t.integer "attachment_id"
18
- t.string "attachment_type"
19
- t.string "tag_name"
20
- t.string "value"
16
+ create_table "spud_liquid_tags", force: :cascade do |t|
17
+ t.integer "attachment_id", limit: 4
18
+ t.string "attachment_type", limit: 255
19
+ t.string "tag_name", limit: 255
20
+ t.string "value", limit: 255
21
21
  t.datetime "created_at"
22
22
  t.datetime "updated_at"
23
23
  end
24
24
 
25
25
  add_index "spud_liquid_tags", ["tag_name", "value"], name: "index_spud_liquid_tags_on_tag_name_and_value", using: :btree
26
26
 
27
- create_table "spud_menu_items", force: true do |t|
28
- t.string "parent_type"
29
- t.integer "parent_id"
30
- t.integer "item_type"
31
- t.integer "spud_page_id"
32
- t.integer "menu_order", default: 0
33
- t.string "url"
27
+ create_table "spud_menu_items", force: :cascade do |t|
28
+ t.string "parent_type", limit: 255
29
+ t.integer "parent_id", limit: 4
30
+ t.integer "item_type", limit: 4
31
+ t.integer "spud_page_id", limit: 4
32
+ t.integer "menu_order", limit: 4, default: 0
33
+ t.string "url", limit: 255
34
34
  t.datetime "created_at"
35
35
  t.datetime "updated_at"
36
- t.string "name"
37
- t.integer "spud_menu_id"
38
- t.string "classes"
36
+ t.string "name", limit: 255
37
+ t.integer "spud_menu_id", limit: 4
38
+ t.string "classes", limit: 255
39
39
  end
40
40
 
41
41
  add_index "spud_menu_items", ["menu_order"], name: "index_spud_menu_items_on_menu_order", using: :btree
42
42
  add_index "spud_menu_items", ["parent_type", "parent_id"], name: "index_spud_menu_items_on_parent_type_and_parent_id", using: :btree
43
43
  add_index "spud_menu_items", ["spud_menu_id"], name: "index_spud_menu_items_on_spud_menu_id", using: :btree
44
44
 
45
- create_table "spud_menus", force: true do |t|
46
- t.string "name"
47
- t.text "description"
45
+ create_table "spud_menus", force: :cascade do |t|
46
+ t.string "name", limit: 255
47
+ t.text "description", limit: 65535
48
48
  t.datetime "created_at"
49
49
  t.datetime "updated_at"
50
- t.integer "site_id", default: 0, null: false
51
50
  end
52
51
 
53
- add_index "spud_menus", ["site_id"], name: "index_spud_menus_on_site_id", using: :btree
54
-
55
- create_table "spud_page_partial_revisions", force: true do |t|
56
- t.string "name"
57
- t.text "content"
58
- t.string "format"
59
- t.integer "spud_page_id"
52
+ create_table "spud_page_partial_revisions", force: :cascade do |t|
53
+ t.string "name", limit: 255
54
+ t.text "content", limit: 65535
55
+ t.string "format", limit: 255
56
+ t.integer "spud_page_id", limit: 4
60
57
  t.datetime "created_at"
61
58
  t.datetime "updated_at"
62
59
  end
63
60
 
64
61
  add_index "spud_page_partial_revisions", ["spud_page_id", "name"], name: "revision_idx", using: :btree
65
62
 
66
- create_table "spud_page_partials", force: true do |t|
67
- t.integer "spud_page_id"
68
- t.string "name"
69
- t.text "content"
70
- t.string "format"
63
+ create_table "spud_page_partials", force: :cascade do |t|
64
+ t.integer "spud_page_id", limit: 4
65
+ t.string "name", limit: 255
66
+ t.text "content", limit: 65535
67
+ t.string "format", limit: 255
71
68
  t.datetime "created_at"
72
69
  t.datetime "updated_at"
73
- t.string "symbol_name"
74
- t.text "content_processed"
70
+ t.string "symbol_name", limit: 255
71
+ t.text "content_processed", limit: 65535
75
72
  end
76
73
 
77
74
  add_index "spud_page_partials", ["spud_page_id"], name: "index_spud_page_partials_on_spud_page_id", using: :btree
78
75
 
79
- create_table "spud_pages", force: true do |t|
80
- t.string "name"
81
- t.string "url_name"
76
+ create_table "spud_pages", force: :cascade do |t|
77
+ t.string "name", limit: 255
78
+ t.string "url_name", limit: 255
82
79
  t.datetime "publish_at"
83
- t.integer "created_by"
84
- t.integer "updated_by"
85
- t.string "format", default: "html"
86
- t.integer "spud_page_id"
87
- t.text "meta_description"
88
- t.string "meta_keywords"
89
- t.integer "page_order"
80
+ t.integer "created_by", limit: 4
81
+ t.integer "updated_by", limit: 4
82
+ t.string "format", limit: 255, default: "html"
83
+ t.integer "spud_page_id", limit: 4
84
+ t.text "meta_description", limit: 65535
85
+ t.string "meta_keywords", limit: 255
86
+ t.integer "page_order", limit: 4
90
87
  t.datetime "created_at"
91
88
  t.datetime "updated_at"
92
- t.integer "visibility", default: 0
93
- t.boolean "published", default: true
94
- t.boolean "use_custom_url_name", default: false
95
- t.text "notes"
96
- t.integer "site_id", default: 0, null: false
97
- t.string "layout"
89
+ t.integer "visibility", limit: 4, default: 0
90
+ t.boolean "published", limit: 1, default: true
91
+ t.boolean "use_custom_url_name", limit: 1, default: false
92
+ t.text "notes", limit: 65535
93
+ t.string "layout", limit: 255
98
94
  end
99
95
 
100
- add_index "spud_pages", ["site_id"], name: "index_spud_pages_on_site_id", using: :btree
101
-
102
- create_table "spud_permalinks", force: true do |t|
103
- t.string "url_name"
104
- t.string "attachment_type"
105
- t.integer "attachment_id"
96
+ create_table "spud_permalinks", force: :cascade do |t|
97
+ t.string "url_name", limit: 255
98
+ t.string "attachment_type", limit: 255
99
+ t.integer "attachment_id", limit: 4
106
100
  t.datetime "created_at"
107
101
  t.datetime "updated_at"
108
- t.integer "site_id", default: 0, null: false
102
+ t.integer "site_id", limit: 4, default: 0, null: false
109
103
  end
110
104
 
111
105
  add_index "spud_permalinks", ["attachment_type", "attachment_id"], name: "idx_permalink_attachment", using: :btree
112
106
  add_index "spud_permalinks", ["site_id"], name: "idx_permalinks_site_id", using: :btree
113
107
 
114
- create_table "spud_permissions", force: true do |t|
115
- t.string "name", null: false
116
- t.string "tag", null: false
108
+ create_table "spud_permissions", force: :cascade do |t|
109
+ t.string "name", limit: 255, null: false
110
+ t.string "tag", limit: 255, null: false
117
111
  t.datetime "created_at"
118
112
  t.datetime "updated_at"
119
113
  end
120
114
 
121
115
  add_index "spud_permissions", ["tag"], name: "index_spud_permissions_on_tag", unique: true, using: :btree
122
116
 
123
- create_table "spud_role_permissions", force: true do |t|
124
- t.integer "spud_role_id", null: false
125
- t.string "spud_permission_tag", null: false
117
+ create_table "spud_role_permissions", force: :cascade do |t|
118
+ t.integer "spud_role_id", limit: 4, null: false
119
+ t.string "spud_permission_tag", limit: 255, null: false
126
120
  t.datetime "created_at"
127
121
  t.datetime "updated_at"
128
122
  end
@@ -130,55 +124,53 @@ ActiveRecord::Schema.define(version: 20140110051484) do
130
124
  add_index "spud_role_permissions", ["spud_permission_tag"], name: "index_spud_role_permissions_on_spud_permission_tag", using: :btree
131
125
  add_index "spud_role_permissions", ["spud_role_id"], name: "index_spud_role_permissions_on_spud_role_id", using: :btree
132
126
 
133
- create_table "spud_roles", force: true do |t|
134
- t.string "name"
127
+ create_table "spud_roles", force: :cascade do |t|
128
+ t.string "name", limit: 255
135
129
  t.datetime "created_at"
136
130
  t.datetime "updated_at"
137
131
  end
138
132
 
139
- create_table "spud_snippets", force: true do |t|
140
- t.string "name"
141
- t.text "content"
142
- t.string "format"
143
- t.text "content_processed"
144
- t.integer "site_id", default: 0
133
+ create_table "spud_snippets", force: :cascade do |t|
134
+ t.string "name", limit: 255
135
+ t.text "content", limit: 65535
136
+ t.string "format", limit: 255
137
+ t.text "content_processed", limit: 65535
145
138
  t.datetime "created_at"
146
139
  t.datetime "updated_at"
147
140
  end
148
141
 
149
142
  add_index "spud_snippets", ["name"], name: "index_spud_snippets_on_name", using: :btree
150
- add_index "spud_snippets", ["site_id"], name: "index_spud_snippets_on_site_id", using: :btree
151
143
 
152
- create_table "spud_user_settings", force: true do |t|
153
- t.integer "spud_user_id"
154
- t.string "key"
155
- t.string "value"
144
+ create_table "spud_user_settings", force: :cascade do |t|
145
+ t.integer "spud_user_id", limit: 4
146
+ t.string "key", limit: 255
147
+ t.string "value", limit: 255
156
148
  t.datetime "created_at"
157
149
  t.datetime "updated_at"
158
150
  end
159
151
 
160
- create_table "spud_users", force: true do |t|
161
- t.string "first_name"
162
- t.string "last_name"
163
- t.boolean "super_admin"
164
- t.string "login", null: false
165
- t.string "email", null: false
166
- t.string "crypted_password", null: false
167
- t.string "password_salt", null: false
168
- t.string "persistence_token", null: false
169
- t.string "single_access_token", null: false
170
- t.string "perishable_token", null: false
171
- t.integer "login_count", default: 0, null: false
172
- t.integer "failed_login_count", default: 0, null: false
152
+ create_table "spud_users", force: :cascade do |t|
153
+ t.string "first_name", limit: 255
154
+ t.string "last_name", limit: 255
155
+ t.boolean "super_admin", limit: 1
156
+ t.string "login", limit: 255, null: false
157
+ t.string "email", limit: 255, null: false
158
+ t.string "crypted_password", limit: 255, null: false
159
+ t.string "password_salt", limit: 255, null: false
160
+ t.string "persistence_token", limit: 255, null: false
161
+ t.string "single_access_token", limit: 255, null: false
162
+ t.string "perishable_token", limit: 255, null: false
163
+ t.integer "login_count", limit: 4, default: 0, null: false
164
+ t.integer "failed_login_count", limit: 4, default: 0, null: false
173
165
  t.datetime "last_request_at"
174
166
  t.datetime "current_login_at"
175
167
  t.datetime "last_login_at"
176
- t.string "current_login_ip"
177
- t.string "last_login_ip"
168
+ t.string "current_login_ip", limit: 255
169
+ t.string "last_login_ip", limit: 255
178
170
  t.datetime "created_at"
179
171
  t.datetime "updated_at"
180
- t.string "time_zone"
181
- t.integer "spud_role_id"
172
+ t.string "time_zone", limit: 255
173
+ t.integer "spud_role_id", limit: 4
182
174
  end
183
175
 
184
176
  add_index "spud_users", ["email"], name: "index_spud_users_on_email", using: :btree
@@ -1,22 +1,17 @@
1
- require 'spec_helper'
1
+ require 'rails_helper'
2
2
 
3
- describe Cms::ApplicationHelper do
3
+ describe Cms::ApplicationHelper, :type => :helper do
4
4
  before(:each) do
5
5
  helper.output_buffer = ''
6
- Spud::Core.configure do |config|
7
- config.site_name = "Test Site"
8
- config.multisite_mode_enabled = false
9
- config.multisite_config = []
10
- end
11
6
  end
12
7
 
13
- describe :sp_list_menu do
8
+ describe '#sp_list_menu' do
14
9
  it "should be able to find a menu by its name" do
15
10
  menu = FactoryGirl.create(:spud_menu, :name => "Main")
16
11
  2.times { |x| FactoryGirl.create(:spud_menu_item, :parent_id => menu.id, :spud_menu_id => menu.id, :url => "/") }
17
12
 
18
13
  helper.sp_list_menu(:name => "Main", :active_class => "active")
19
- helper.output_buffer.should match /\<li/
14
+ expect(helper.output_buffer).to match /\<li/
20
15
  end
21
16
 
22
17
  it "should assign id to ul block" do
@@ -24,7 +19,7 @@ describe Cms::ApplicationHelper do
24
19
  2.times {|x| s = FactoryGirl.create(:spud_menu_item,:parent_id => menu.id,:spud_menu_id => menu.id,:url => "/")}
25
20
 
26
21
  helper.sp_list_menu(:name => menu.name,:id => "nav")
27
- helper.output_buffer.should match /id=\'nav\'/
22
+ expect(helper.output_buffer).to match /id=\'nav\'/
28
23
  end
29
24
 
30
25
  it "should render nested menu items" do
@@ -34,7 +29,7 @@ describe Cms::ApplicationHelper do
34
29
  s3 = FactoryGirl.create(:spud_menu_item,:parent_type => "SpudMenuItem",:parent_id => s.id,:spud_menu_id => menu.id,:url => "/",:name => "SubItem")
35
30
 
36
31
  helper.sp_list_menu(:name => "Main2")
37
- helper.output_buffer.should match /SubItem/
32
+ expect(helper.output_buffer).to match /SubItem/
38
33
  end
39
34
 
40
35
  it "should respect max depth" do
@@ -44,24 +39,11 @@ describe Cms::ApplicationHelper do
44
39
  s3 = FactoryGirl.create(:spud_menu_item,:parent_type => "SpudMenuItem",:parent_id => s.id,:spud_menu_id => menu.id,:url => "/",:name => "SubItem")
45
40
 
46
41
  helper.sp_list_menu(:name => "Main4",:max_depth => 1)
47
- helper.output_buffer.should_not match /SubItem/
48
- end
49
-
50
- it "should not load menu from different site_id" do
51
- Spud::Core.configure do |config|
52
- config.site_name = "Test Site"
53
- config.multisite_mode_enabled = true
54
- config.multisite_config = [{:hosts => ["test.host"], :site_name =>"Site B", :site_id => 1}]
55
- end
56
- menu = FactoryGirl.create(:spud_menu,:site_id => 0)
57
- s = FactoryGirl.create(:spud_menu_item,:parent_id => menu.id,:spud_menu_id => menu.id,:url => "/")
58
-
59
- helper.sp_list_menu(:name => menu.name).should be_blank
60
-
42
+ expect(helper.output_buffer).to_not match /SubItem/
61
43
  end
62
44
  end
63
45
 
64
- describe :sp_menu_with_seperator do
46
+ describe '#sp_menu_with_seperator' do
65
47
  it "should render a flattened list of links" do
66
48
  menu = FactoryGirl.create(:spud_menu,:name => "Main3")
67
49
  s = FactoryGirl.create(:spud_menu_item,:parent_id => menu.id,:spud_menu_id => menu.id,:url => "/")
@@ -69,27 +51,12 @@ describe Cms::ApplicationHelper do
69
51
  s3 = FactoryGirl.create(:spud_menu_item,:parent_type => "SpudMenuItem",:parent_id => s.id,:spud_menu_id => menu.id,:url => "/",:name => "SubItem")
70
52
 
71
53
  content = helper.sp_menu_with_seperator(:name => "Main3")
72
- content.should match /SubItem/
73
- content.should_not match /\<li/
74
- end
75
-
76
- it "should not load menu from different site_id" do
77
-
78
- Spud::Core.configure do |config|
79
- config.site_name = "Test Site"
80
- config.multisite_mode_enabled = true
81
- config.multisite_config = [{:hosts => ["test.host"], :site_name =>"Site B", :site_id => 1}]
82
- end
83
- menu = FactoryGirl.create(:spud_menu,:site_id => 0)
84
- s = FactoryGirl.create(:spud_menu_item,:parent_id => menu.id,:spud_menu_id => menu.id,:url => "/")
85
- helper.sp_menu_with_seperator(:name => menu.name).should be_blank
86
-
54
+ expect(content).to match /SubItem/
55
+ expect(content).to_not match /\<li/
87
56
  end
88
-
89
-
90
57
  end
91
58
 
92
- describe :sp_list_pages do
59
+ describe '#sp_list_pages' do
93
60
  it "should be able to list created pages" do
94
61
  page = FactoryGirl.create(:spud_page)
95
62
  page2 = FactoryGirl.create(:spud_page)
@@ -97,9 +64,9 @@ describe Cms::ApplicationHelper do
97
64
 
98
65
 
99
66
  content = helper.sp_list_pages(:active_class => "active")
100
- content.should match /#{page.name}/
101
- content.should match /#{page2.name}/
102
- content.should match /#{page3.name}/
67
+ expect(content).to match /#{page.name}/
68
+ expect(content).to match /#{page2.name}/
69
+ expect(content).to match /#{page3.name}/
103
70
  end
104
71
 
105
72
  it "should assign id" do
@@ -107,7 +74,7 @@ describe Cms::ApplicationHelper do
107
74
  page2 = FactoryGirl.create(:spud_page)
108
75
 
109
76
  content = helper.sp_list_pages(:id => "page_nav")
110
- content.should match /id=\'page_nav\'/
77
+ expect(content).to match /id=\'page_nav\'/
111
78
 
112
79
  end
113
80
 
@@ -116,8 +83,8 @@ describe Cms::ApplicationHelper do
116
83
  page2 = FactoryGirl.create(:spud_page)
117
84
 
118
85
  content = helper.sp_list_pages(:exclude => [page2.name])
119
- content.should match /#{page.name}/
120
- content.should_not match /#{page2.name}/
86
+ expect(content).to match /#{page.name}/
87
+ expect(content).to_not match /#{page2.name}/
121
88
  end
122
89
  it "should respect max depth" do
123
90
  page = FactoryGirl.create(:spud_page)
@@ -126,37 +93,19 @@ describe Cms::ApplicationHelper do
126
93
 
127
94
 
128
95
  content = helper.sp_list_pages(:max_depth => 1)
129
- content.should match /#{page.name}/
130
- content.should match /#{page2.name}/
131
- content.should_not match /#{page3.name}/
96
+ expect(content).to match /#{page.name}/
97
+ expect(content).to match /#{page2.name}/
98
+ expect(content).to_not match /#{page3.name}/
132
99
  end
133
100
 
134
-
135
101
  it "should be able to list sub pages of a particular page" do
136
102
  page = FactoryGirl.create(:spud_page)
137
103
  page2 = FactoryGirl.create(:spud_page)
138
104
  page3 = FactoryGirl.create(:spud_page,:spud_page_id => page.id)
139
105
  content = helper.sp_list_pages(:start_page_id => page.id)
140
- content.should_not match /#{page.name}/
141
- content.should_not match /#{page2.name}/
142
- content.should match /#{page3.name}/
143
- end
144
-
145
- it "should not load pages from different site_id" do
146
- Spud::Core.configure do |config|
147
- config.site_name = "Test Site"
148
- config.multisite_mode_enabled = true
149
- config.multisite_config = [{:hosts => ["test.host"], :site_name =>"Site B", :site_id => 1}]
150
- end
151
- page = FactoryGirl.create(:spud_page,:site_id => 0)
152
- page2 = FactoryGirl.create(:spud_page,:site_id => 1)
153
-
154
- content = helper.sp_list_pages()
155
- content.should_not match /#{page.name}/
156
- content.should match /#{page2.name}/
157
-
106
+ expect(content).to_not match /#{page.name}/
107
+ expect(content).to_not match /#{page2.name}/
108
+ expect(content).to match /#{page3.name}/
158
109
  end
159
-
160
-
161
110
  end
162
111
  end
@@ -1,6 +1,6 @@
1
- require 'spec_helper'
1
+ require 'rails_helper'
2
2
 
3
- describe SpudMenuItem do
3
+ describe SpudMenuItem, :type => :model do
4
4
 
5
5
  it {should have_many(:spud_menu_items)}
6
6
  it {should belong_to(:spud_page)}
@@ -10,22 +10,22 @@ describe SpudMenuItem do
10
10
  describe :validations do
11
11
  it "should require a name" do
12
12
  p = FactoryGirl.build(:spud_menu_item,:name => nil)
13
- p.should_not be_valid
13
+ expect(p).to_not be_valid
14
14
  end
15
15
 
16
16
  it "should require a menu_id" do
17
17
  p = FactoryGirl.build(:spud_menu_item,:spud_menu_id => nil)
18
- p.should_not be_valid
18
+ expect(p).to_not be_valid
19
19
  end
20
20
 
21
21
  it "should require a parent_type" do
22
22
  p = FactoryGirl.build(:spud_menu_item,:parent_type => nil)
23
- p.should_not be_valid
23
+ expect(p).to_not be_valid
24
24
  end
25
25
 
26
26
  it "should require a parent_id" do
27
27
  p = FactoryGirl.build(:spud_menu_item,:parent_id => nil)
28
- p.should_not be_valid
28
+ expect(p).to_not be_valid
29
29
  end
30
30
  end
31
31
  end
@@ -1,5 +1,5 @@
1
- require 'spec_helper'
1
+ require 'rails_helper'
2
2
 
3
- describe SpudPagePartialRevision do
3
+ describe SpudPagePartialRevision, :type => :model do
4
4
  pending "add some examples to (or delete) #{__FILE__}"
5
5
  end
@@ -1,28 +1,28 @@
1
- require 'spec_helper'
1
+ require 'rails_helper'
2
2
 
3
- describe SpudPagePartial do
3
+ describe SpudPagePartial, :type => :model do
4
4
  describe "validations" do
5
5
 
6
6
  it "should require a name" do
7
7
  p = FactoryGirl.build(:spud_page_partial,:name => nil)
8
- p.should_not be_valid
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
12
  p = FactoryGirl.build(:spud_page_partial,:name => "Test Page")
13
- p.symbol_name.should == "test_page"
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")
20
- p.attributes["symbol_name"].should == "test_page"
19
+ p = FactoryGirl.create(:spud_page_partial, :name => "Test Page")
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 =>"Home Sweet Home",:spud_page_id => 1)
25
- SpudPagePartialRevision.where(:spud_page_id => 1,:name => "Test Page").count.should == 1
24
+ p = FactoryGirl.create(:spud_page_partial, :name => "Test Page", :content => 'Content')
25
+ expect(SpudPagePartialRevision.where(:spud_page_id => p.spud_page_id).count).to eq(1)
26
26
  end
27
27
 
28
28
  it "should delete old revisions beyond max_revision count" do
@@ -35,7 +35,7 @@ describe SpudPagePartial do
35
35
 
36
36
  p.content = "Another change"
37
37
  p.save
38
- SpudPagePartialRevision.where(:spud_page_id => 1,:name => "Test Page").count.should == 2
38
+ expect(SpudPagePartialRevision.where(:spud_page_id => 1,:name => "Test Page").count).to eq(2)
39
39
  end
40
40
 
41
41
  end