camaleon_cms 2.4.5.5 → 2.4.5.7

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of camaleon_cms might be problematic. Click here for more details.

Files changed (82) hide show
  1. checksums.yaml +4 -4
  2. data/app/apps/themes/default/views/partials/_comments.html.erb +36 -21
  3. data/app/apps/themes/default/views/post.html.erb +1 -1
  4. data/app/assets/javascripts/camaleon_cms/admin/uploader/_media_manager.js.coffee +4 -4
  5. data/app/controllers/camaleon_cms/admin/categories_controller.rb +3 -0
  6. data/app/controllers/camaleon_cms/admin/media_controller.rb +9 -6
  7. data/app/controllers/camaleon_cms/admin/sessions_controller.rb +1 -1
  8. data/app/controllers/camaleon_cms/admin/settings/post_types_controller.rb +2 -0
  9. data/app/controllers/concerns/camaleon_cms/frontend_concern.rb +17 -13
  10. data/app/decorators/camaleon_cms/post_decorator.rb +0 -1
  11. data/app/helpers/camaleon_cms/captcha_helper.rb +1 -1
  12. data/app/helpers/camaleon_cms/frontend/nav_menu_helper.rb +1 -0
  13. data/app/helpers/camaleon_cms/hooks_helper.rb +6 -1
  14. data/app/helpers/camaleon_cms/site_helper.rb +1 -1
  15. data/app/helpers/camaleon_cms/uploader_helper.rb +36 -27
  16. data/app/models/camaleon_cms/custom_fields_relationship.rb +6 -0
  17. data/app/models/camaleon_cms/media.rb +54 -0
  18. data/app/models/camaleon_cms/post.rb +1 -0
  19. data/app/models/camaleon_cms/site.rb +7 -0
  20. data/app/uploaders/camaleon_cms_aws_uploader.rb +21 -23
  21. data/app/uploaders/camaleon_cms_local_uploader.rb +20 -26
  22. data/app/uploaders/camaleon_cms_uploader.rb +17 -45
  23. data/app/views/camaleon_cms/admin/categories/index.html.erb +2 -2
  24. data/app/views/camaleon_cms/admin/media/_render_file_item.html.erb +53 -36
  25. data/app/views/camaleon_cms/admin/media/index.html.erb +1 -1
  26. data/app/views/camaleon_cms/admin/post_tags/index.html.erb +4 -4
  27. data/app/views/camaleon_cms/admin/posts/index.html.erb +1 -0
  28. data/app/views/camaleon_cms/admin/settings/_configuration_settings.html.erb +5 -1
  29. data/app/views/camaleon_cms/admin/settings/post_types/_form.html.erb +1 -1
  30. data/app/views/camaleon_cms/default_theme/partials/_comments.html.erb +45 -28
  31. data/app/views/camaleon_cms/default_theme/single.html.erb +1 -1
  32. data/config/locales/camaleon_cms/admin/es.yml +1 -0
  33. data/config/locales/camaleon_cms/admin/js.yml +54 -3
  34. data/config/locales/camaleon_cms/admin/ru.yml +39 -28
  35. data/db/migrate/20180124132318_create_media.rb +17 -0
  36. data/lib/camaleon_cms/version.rb +1 -1
  37. data/lib/ext/string.rb +8 -0
  38. data/lib/generators/camaleon_cms/gem_plugin_generator.rb +29 -25
  39. data/lib/plugin_routes.rb +27 -0
  40. data/spec/dummy/config/application.rb +1 -0
  41. data/spec/dummy/config/environments/test.rb +2 -0
  42. data/spec/dummy/db/schema.rb +1 -140
  43. data/spec/dummy/db/test.sqlite3 +0 -0
  44. data/spec/dummy/public/favicon.ico +0 -0
  45. data/spec/factories/post_type.rb +17 -0
  46. data/spec/factories/site.rb +8 -0
  47. data/spec/features/{categories_spec.rb → admin/categories_spec.rb} +1 -1
  48. data/spec/features/{comments_spec.rb → admin/comments_spec.rb} +16 -9
  49. data/spec/features/{contact_form_spec.rb → admin/contact_form_spec.rb} +16 -9
  50. data/spec/features/{content_groups_spec.rb → admin/content_groups_spec.rb} +19 -11
  51. data/spec/features/{custom_fields_spec.rb → admin/custom_fields_spec.rb} +1 -1
  52. data/spec/features/{languages_spec.rb → admin/languages_spec.rb} +1 -1
  53. data/spec/features/{media_spec.rb → admin/media_spec.rb} +1 -1
  54. data/spec/features/{menus_spec.rb → admin/menus_spec.rb} +2 -2
  55. data/spec/features/{pages_spec.rb → admin/pages_spec.rb} +1 -1
  56. data/spec/features/{plugins_spec.rb → admin/plugins_spec.rb} +1 -1
  57. data/spec/features/{posts_spec.rb → admin/posts_spec.rb} +4 -3
  58. data/spec/features/admin/session_spec.rb +102 -0
  59. data/spec/features/{settings_spec.rb → admin/settings_spec.rb} +1 -1
  60. data/spec/features/{shortcodes_spec.rb → admin/shortcodes_spec.rb} +1 -1
  61. data/spec/features/{sites_spec.rb → admin/sites_spec.rb} +22 -14
  62. data/spec/features/{tags_spec.rb → admin/tags_spec.rb} +17 -8
  63. data/spec/features/{themes_spec.rb → admin/themes_spec.rb} +1 -1
  64. data/spec/features/{user_roles_spec.rb → admin/user_roles_spec.rb} +25 -19
  65. data/spec/features/{users_spec.rb → admin/users_spec.rb} +2 -2
  66. data/spec/features/{widgets_spec.rb → admin/widgets_spec.rb} +19 -12
  67. data/spec/features/frontend/pages_spec.rb +86 -5
  68. data/spec/features/frontend/post_type_spec.rb +16 -0
  69. data/spec/helpers/email_helper_spec.rb +1 -1
  70. data/spec/helpers/uploader_helper_spec.rb +56 -0
  71. data/spec/mailers/send_mail_spec.rb +3 -3
  72. data/spec/{decorators/camaleon_cms/post_decorator_spec.rb → models/post_spec.rb} +3 -3
  73. data/spec/rails_helper.rb +79 -0
  74. data/spec/spec_helper.rb +25 -56
  75. data/spec/support/common.rb +10 -24
  76. data/spec/support/fixtures/rails.png +0 -0
  77. data/spec/support/fixtures/rails_tmp.png +0 -0
  78. metadata +64 -50
  79. data/app/views/camaleon_cms/admin/media/_files_list.html.erb +0 -2
  80. data/app/views/camaleon_cms/admin/media/_render_folder_item.html.erb +0 -15
  81. data/spec/decorators/post_type_spec.rb +0 -13
  82. data/spec/features/session_spec.rb +0 -74
@@ -59,39 +59,41 @@ module CamaleonCms
59
59
 
60
60
 
61
61
  directory(plugin_app, plugin_dir)
62
- gsub_file File.join(plugin_dir, "config", "routes.rb"), "end" do
63
- "
64
- scope PluginRoutes.system_info[\"relative_url_root\"] do
65
- scope '(:locale)', locale: /\#{PluginRoutes.all_locales}/, :defaults => { } do
66
- # frontend
67
- namespace :plugins do
68
- namespace '#{get_plugin_name}' do
69
- get 'index' => 'front#index'
70
- end
62
+ gsub_file File.join(plugin_dir, "config", "routes.rb"), /.+/ do
63
+ "require 'plugin_routes'
64
+ require 'camaleon_cms/engine'
65
+ Rails.application.routes.draw do
66
+ scope PluginRoutes.system_info[\"relative_url_root\"] do
67
+ scope '(:locale)', locale: /\#{PluginRoutes.all_locales}/, :defaults => { } do
68
+ # frontend
69
+ namespace :plugins do
70
+ namespace '#{get_plugin_name}' do
71
+ get 'index' => 'front#index'
71
72
  end
72
73
  end
74
+ end
73
75
 
74
- #Admin Panel
75
- scope :admin, as: 'admin', path: PluginRoutes.system_info['admin_path_name'] do
76
- namespace 'plugins' do
77
- namespace '#{get_plugin_name}' do
78
- controller :admin do
79
- get :index
80
- get :settings
81
- post :save_settings
82
- end
76
+ #Admin Panel
77
+ scope :admin, as: 'admin', path: PluginRoutes.system_info['admin_path_name'] do
78
+ namespace 'plugins' do
79
+ namespace '#{get_plugin_name}' do
80
+ controller :admin do
81
+ get :index
82
+ get :settings
83
+ post :save_settings
83
84
  end
84
85
  end
85
86
  end
86
-
87
- # main routes
88
- #scope '#{get_plugin_name}', module: 'plugins/#{get_plugin_name}/', as: '#{get_plugin_name}' do
89
- # Here my routes for main routes
90
- #end
91
87
  end
92
- end"
88
+
89
+ # main routes
90
+ #scope '#{get_plugin_name}', module: 'plugins/#{get_plugin_name}/', as: '#{get_plugin_name}' do
91
+ # Here my routes for main routes
92
+ #end
93
+ end
94
+ end"
93
95
  end
94
-
96
+
95
97
  if PluginRoutes.isRails4?
96
98
  append_to_file Rails.root.join("Gemfile") do
97
99
  "\n\ngem '#{get_plugin_name}', path: '#{plugin_dir_path}'"
@@ -107,6 +109,8 @@ module CamaleonCms
107
109
  # remove TODO text from gem
108
110
  gemspec_file = File.join(plugin_dir, "#{get_plugin_name}.gemspec")
109
111
  t = File.read(gemspec_file).gsub("TODO", "")
112
+ # add Camaleon as plugin dependency
113
+ t.sub!(/s\.add_dependency "rails".*\n/, "s.add_dependency \"camaleon_cms\", \"~> 2.0\"\n")
110
114
  File.open(gemspec_file, "w"){|f| f << t }
111
115
  end
112
116
  end
@@ -2,6 +2,7 @@ require 'json'
2
2
  class PluginRoutes
3
3
  @@_vars = []
4
4
  @@_after_reload = []
5
+ @@anonymous_hooks = {}
5
6
  # load plugin routes if it is enabled
6
7
  def self.load(env = "admin")
7
8
  plugins = all_enabled_plugins
@@ -108,6 +109,32 @@ class PluginRoutes
108
109
  def fixActionParameter(h)
109
110
  (h.is_a?(ActionController::Parameters) ? (h.permit!.to_h rescue h.to_hash) : h)
110
111
  end
112
+
113
+ # add a new anonymous hook
114
+ # sample: PluginRoutes.add_anonymous_hook('before_admin', lambda{|params| puts params })
115
+ # @param hook_key [String], key of hook
116
+ # @param hook_id [String], identifier for the anonymous hook
117
+ # @param callback [Lambda], anonymous function to be called when the hook was called
118
+ # @return nil
119
+ def add_anonymous_hook(hook_key, callback, hook_id = '')
120
+ @@anonymous_hooks[hook_key] ||= []
121
+ @@anonymous_hooks[hook_key] << {id: hook_id, callback: callback}
122
+ end
123
+
124
+ # return all registered anonymous hooks for hook_key
125
+ # @param hook_key [String] name of the hook
126
+ # @return [Array] array of hooks for hook_key
127
+ def get_anonymous_hooks(hook_key)
128
+ (@@anonymous_hooks[hook_key.to_s] || []).map{|item| item[:callback] }
129
+ end
130
+
131
+ # return all registered anonymous hooks for hook_key
132
+ # @param hook_key [String] name of the hook
133
+ # @param hook_id [String] identifier of the anonymous hooks
134
+ # @return [Array] array of hooks for hook_key
135
+ def remove_anonymous_hook(hook_key, hook_id)
136
+ (@@anonymous_hooks[hook_key.to_s] || []).delete_if{|item| item[:id] == hook_id }
137
+ end
111
138
  end
112
139
 
113
140
  # reload routes
@@ -21,5 +21,6 @@ module Dummy
21
21
 
22
22
  # Do not swallow errors in after_commit/after_rollback callbacks.
23
23
  # config.active_record.raise_in_transactional_callbacks = true
24
+ config.active_record.sqlite3.represent_boolean_as_integer = true
24
25
  end
25
26
  end
@@ -39,4 +39,6 @@ Rails.application.configure do
39
39
 
40
40
  # Raises error for missing translations
41
41
  # config.action_view.raise_on_missing_translations = true
42
+
43
+ config.middleware.use RackSessionAccess::Middleware
42
44
  end
@@ -10,68 +10,7 @@
10
10
  #
11
11
  # It's strongly recommended that you check this file into your version control system.
12
12
 
13
- ActiveRecord::Schema.define(version: 20161215202255) do
14
-
15
- create_table "comments", force: :cascade do |t|
16
- t.string "author"
17
- t.string "author_email"
18
- t.string "author_url"
19
- t.string "author_IP"
20
- t.text "content"
21
- t.string "approved", default: "pending"
22
- t.string "agent"
23
- t.string "typee"
24
- t.integer "comment_parent"
25
- t.integer "post_id"
26
- t.integer "user_id"
27
- t.datetime "created_at", null: false
28
- t.datetime "updated_at", null: false
29
- t.index ["approved"], name: "index_comments_on_approved"
30
- t.index ["comment_parent"], name: "index_comments_on_comment_parent"
31
- t.index ["post_id"], name: "index_comments_on_post_id"
32
- t.index ["user_id"], name: "index_comments_on_user_id"
33
- end
34
-
35
- create_table "custom_fields", force: :cascade do |t|
36
- t.string "object_class"
37
- t.string "name"
38
- t.string "slug"
39
- t.integer "objectid"
40
- t.integer "parent_id"
41
- t.integer "field_order"
42
- t.integer "count", default: 0
43
- t.boolean "is_repeat", default: false
44
- t.text "description"
45
- t.string "status"
46
- t.index ["object_class"], name: "index_custom_fields_on_object_class"
47
- t.index ["objectid"], name: "index_custom_fields_on_objectid"
48
- t.index ["parent_id"], name: "index_custom_fields_on_parent_id"
49
- t.index ["slug"], name: "index_custom_fields_on_slug"
50
- end
51
-
52
- create_table "custom_fields_relationships", force: :cascade do |t|
53
- t.integer "objectid"
54
- t.integer "custom_field_id"
55
- t.integer "term_order"
56
- t.string "object_class"
57
- t.text "value", limit: 1073741823
58
- t.string "custom_field_slug"
59
- t.integer "group_number", default: 0
60
- t.index ["custom_field_id"], name: "index_custom_fields_relationships_on_custom_field_id"
61
- t.index ["custom_field_slug"], name: "index_custom_fields_relationships_on_custom_field_slug"
62
- t.index ["object_class"], name: "index_custom_fields_relationships_on_object_class"
63
- t.index ["objectid"], name: "index_custom_fields_relationships_on_objectid"
64
- end
65
-
66
- create_table "metas", force: :cascade do |t|
67
- t.string "key"
68
- t.text "value", limit: 1073741823
69
- t.integer "objectid"
70
- t.string "object_class"
71
- t.index ["key"], name: "index_metas_on_key"
72
- t.index ["object_class"], name: "index_metas_on_object_class"
73
- t.index ["objectid"], name: "index_metas_on_objectid"
74
- end
13
+ ActiveRecord::Schema.define(version: 2016_05_17_143441) do
75
14
 
76
15
  create_table "plugins_contact_forms", force: :cascade do |t|
77
16
  t.integer "site_id"
@@ -86,82 +25,4 @@ ActiveRecord::Schema.define(version: 20161215202255) do
86
25
  t.datetime "updated_at"
87
26
  end
88
27
 
89
- create_table "posts", force: :cascade do |t|
90
- t.string "title"
91
- t.string "slug"
92
- t.text "content", limit: 1073741823
93
- t.text "content_filtered", limit: 1073741823
94
- t.string "status", default: "published"
95
- t.datetime "published_at"
96
- t.integer "post_parent"
97
- t.string "visibility", default: "public"
98
- t.text "visibility_value"
99
- t.string "post_class", default: "Post"
100
- t.datetime "created_at", null: false
101
- t.datetime "updated_at", null: false
102
- t.integer "user_id"
103
- t.integer "post_order", default: 0
104
- t.integer "taxonomy_id"
105
- t.boolean "is_feature", default: false
106
- t.index ["post_class"], name: "index_posts_on_post_class"
107
- t.index ["post_parent"], name: "index_posts_on_post_parent"
108
- t.index ["slug"], name: "index_posts_on_slug"
109
- t.index ["status"], name: "index_posts_on_status"
110
- t.index ["user_id"], name: "index_posts_on_user_id"
111
- end
112
-
113
- create_table "term_relationships", force: :cascade do |t|
114
- t.integer "objectid"
115
- t.integer "term_order"
116
- t.integer "term_taxonomy_id"
117
- t.index ["objectid"], name: "index_term_relationships_on_objectid"
118
- t.index ["term_order"], name: "index_term_relationships_on_term_order"
119
- t.index ["term_taxonomy_id"], name: "index_term_relationships_on_term_taxonomy_id"
120
- end
121
-
122
- create_table "term_taxonomy", force: :cascade do |t|
123
- t.string "taxonomy"
124
- t.text "description", limit: 1073741823
125
- t.integer "parent_id"
126
- t.integer "count"
127
- t.string "name"
128
- t.string "slug"
129
- t.integer "term_group"
130
- t.integer "term_order"
131
- t.string "status"
132
- t.datetime "created_at", null: false
133
- t.datetime "updated_at", null: false
134
- t.integer "user_id"
135
- t.index ["parent_id"], name: "index_term_taxonomy_on_parent_id"
136
- t.index ["slug"], name: "index_term_taxonomy_on_slug"
137
- t.index ["taxonomy"], name: "index_term_taxonomy_on_taxonomy"
138
- t.index ["term_order"], name: "index_term_taxonomy_on_term_order"
139
- t.index ["user_id"], name: "index_term_taxonomy_on_user_id"
140
- end
141
-
142
- create_table "users", force: :cascade do |t|
143
- t.string "username"
144
- t.string "role", default: "client"
145
- t.string "email"
146
- t.string "slug"
147
- t.string "password_digest"
148
- t.string "auth_token"
149
- t.string "password_reset_token"
150
- t.integer "parent_id"
151
- t.datetime "password_reset_sent_at"
152
- t.datetime "last_login_at"
153
- t.datetime "created_at", null: false
154
- t.datetime "updated_at", null: false
155
- t.integer "site_id", default: -1
156
- t.string "confirm_email_token"
157
- t.datetime "confirm_email_sent_at"
158
- t.boolean "is_valid_email", default: true
159
- t.string "first_name"
160
- t.string "last_name"
161
- t.index ["email"], name: "index_users_on_email"
162
- t.index ["role"], name: "index_users_on_role"
163
- t.index ["site_id"], name: "index_users_on_site_id"
164
- t.index ["username"], name: "index_users_on_username"
165
- end
166
-
167
28
  end
@@ -0,0 +1,17 @@
1
+ include CamaleonCms::SiteHelper
2
+ include CamaleonCms::HooksHelper
3
+ FactoryBot.define do
4
+ factory :site, class: CamaleonCms::Site do
5
+ name { Faker::Name.unique.name }
6
+ slug { Capybara.current_session.server ? "#{Capybara.current_session.server.host}:#{Capybara.current_session.server.port}" : 'key' }
7
+ description Faker::Lorem.sentence
8
+ transient do
9
+ theme PluginRoutes.all_themes.first['key']
10
+ skip_intro true
11
+ end
12
+ after(:create) do |site, evaluator|
13
+ site_after_install(site, evaluator.theme)
14
+ site.set_option('save_intro', true) if evaluator.skip_intro
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,8 @@
1
+ FactoryBot.define do
2
+ factory :post_type, class: CamaleonCms::PostType do
3
+ name { Faker::Name.unique.name }
4
+ description Faker::Lorem.sentence
5
+ data_options {}
6
+ site
7
+ end
8
+ end
@@ -1,6 +1,6 @@
1
1
  require "rails_helper"
2
2
  describe "the signin process", js: true do
3
- login_success
3
+ init_site
4
4
 
5
5
  it "create new category" do
6
6
  admin_sign_in
@@ -1,22 +1,29 @@
1
1
  require "rails_helper"
2
+
3
+ # add a new comment for a post
4
+ def add_new_comment
5
+ visit "#{cama_root_relative_path}/admin/posts/#{get_content_attr("post", "id", "last")}/comments"
6
+ page.execute_script('$("#comments_answer_list .panel-heading .btn-primary").click()')
7
+ wait_for_ajax
8
+ within 'form#new_comment' do
9
+ fill_in "comment_content", with: "Test comment"
10
+ find('button[type="submit"]').click
11
+ end
12
+ end
13
+
2
14
  describe "the Comments", js: true do
3
- login_success
15
+ init_site
4
16
 
5
17
  it "Add Comment" do
6
18
  admin_sign_in
7
- visit "#{cama_root_relative_path}/admin/posts/#{get_content_attr("post", "id", "last")}/comments"
8
- page.execute_script('$("#comments_answer_list .panel-heading .btn-primary").click()')
9
- wait_for_ajax
10
- within 'form#new_comment' do
11
- fill_in "comment_content", with: "Test comment"
12
- find('button[type="submit"]').click
13
- end
19
+ add_new_comment
14
20
  expect(page).to have_css('.alert-success')
15
21
  end
16
22
 
17
23
 
18
24
  it "list comments post" do
19
25
  admin_sign_in
26
+ add_new_comment
20
27
  visit "#{cama_root_relative_path}/admin/comments"
21
28
  within("#admin_content") do
22
29
  # verify post presence
@@ -27,7 +34,7 @@ describe "the Comments", js: true do
27
34
  expect(page).to have_css('#comments_answer_list')
28
35
 
29
36
  # approve || disapprove comment
30
- (first('.approve') || first('.pending')).click
37
+ (first('.pending')).click
31
38
  expect(page).to have_css('.alert-success')
32
39
  end
33
40
 
@@ -1,16 +1,22 @@
1
1
  require "rails_helper"
2
+
3
+ # create a new form
4
+ def create_form
5
+ visit "#{cama_root_relative_path}/admin/plugins/cama_contact_form/admin_forms"
6
+ expect(page).to have_content('Contact Form')
7
+ within("#new_plugins_cama_contact_form_cama_contact_form") do
8
+ fill_in 'plugins_cama_contact_form_cama_contact_form_name', :with => 'Test form'
9
+ fill_in 'plugins_cama_contact_form_cama_contact_form_slug', :with => 'test-form'
10
+ first('button[type="submit"]').click
11
+ end
12
+ end
13
+
2
14
  describe "the Contact Form", js: true do
3
- login_success
15
+ init_site
4
16
 
5
17
  it "create new contact form" do
6
18
  admin_sign_in
7
- visit "#{cama_root_relative_path}/admin/plugins/cama_contact_form/admin_forms"
8
- expect(page).to have_content('Contact Form')
9
- within("#new_plugins_cama_contact_form_cama_contact_form") do
10
- fill_in 'plugins_cama_contact_form_cama_contact_form_name', :with => 'Test form'
11
- fill_in 'plugins_cama_contact_form_cama_contact_form_slug', :with => 'test-form'
12
- first('button[type="submit"]').click
13
- end
19
+ create_form
14
20
  expect(page).to have_css('.alert-success')
15
21
 
16
22
  # adding fields
@@ -31,6 +37,7 @@ describe "the Contact Form", js: true do
31
37
 
32
38
  it "check contact submitters" do
33
39
  admin_sign_in
40
+ create_form
34
41
  visit "#{cama_root_relative_path}/admin/plugins/cama_contact_form/admin_forms"
35
42
  within("#admin_content") do
36
43
  all("table .btn-info").last.click
@@ -42,6 +49,7 @@ describe "the Contact Form", js: true do
42
49
 
43
50
  it "delete contact form" do
44
51
  admin_sign_in
52
+ create_form
45
53
  visit "#{cama_root_relative_path}/admin/plugins/cama_contact_form/admin_forms"
46
54
  within '#admin_content' do
47
55
  all("table .btn-danger").last.click
@@ -49,5 +57,4 @@ describe "the Contact Form", js: true do
49
57
  confirm_dialog
50
58
  expect(page).to have_css('.alert-success')
51
59
  end
52
-
53
60
  end
@@ -1,24 +1,31 @@
1
1
  require "rails_helper"
2
+
3
+ # create a new post type
4
+ def create_post_type
5
+ visit "#{cama_root_relative_path}/admin/settings/post_types"
6
+ expect(page).to have_content('Post')
7
+ expect(page).to have_content('Page')
8
+ within("#post_type_form") do
9
+ fill_in 'post_type_name', :with => 'Test cat'
10
+ fill_in 'post_type_slug', :with => 'test-content'
11
+ fill_in 'post_type_description', :with => 'test-content descri'
12
+ check("Manage Multiple Categories")
13
+ click_button 'Submit'
14
+ end
15
+ end
16
+
2
17
  describe "the Content Groups", js: true do
3
- login_success
18
+ init_site
4
19
 
5
20
  it "create new content group" do
6
21
  admin_sign_in
7
- visit "#{cama_root_relative_path}/admin/settings/post_types"
8
- expect(page).to have_content('Post')
9
- expect(page).to have_content('Page')
10
- within("#post_type_form") do
11
- fill_in 'post_type_name', :with => 'Test cat'
12
- fill_in 'post_type_slug', :with => 'test-content'
13
- fill_in 'post_type_description', :with => 'test-content descri'
14
- check("Manage Multiple Categories")
15
- click_button 'Submit'
16
- end
22
+ create_post_type
17
23
  expect(page).to have_css('.alert-success')
18
24
  end
19
25
 
20
26
  it "edit content type" do
21
27
  admin_sign_in
28
+ create_post_type
22
29
  visit "#{cama_root_relative_path}/admin/settings/post_types"
23
30
  within '#admin_content' do
24
31
  all("table .btn-default").last.click
@@ -34,6 +41,7 @@ describe "the Content Groups", js: true do
34
41
 
35
42
  it "delete content type" do
36
43
  admin_sign_in
44
+ create_post_type
37
45
  visit "#{cama_root_relative_path}/admin/settings/post_types"
38
46
  within '#admin_content' do
39
47
  all("table .btn-danger").last.click