camaleon_cms 2.3.3 → 2.3.4

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 (130) hide show
  1. checksums.yaml +4 -4
  2. data/Rakefile +7 -12
  3. data/app/assets/javascripts/camaleon_cms/admin/_custom_fields.js +1 -2
  4. data/app/assets/javascripts/camaleon_cms/admin/_data.js +1 -0
  5. data/app/assets/javascripts/camaleon_cms/admin/_post.js +1 -1
  6. data/app/assets/javascripts/camaleon_cms/admin/_posttype.js.coffee +21 -0
  7. data/app/assets/javascripts/camaleon_cms/admin/admin-manifest.js +2 -0
  8. data/app/assets/javascripts/camaleon_cms/admin/jquery_validate/fr.js +49 -0
  9. data/app/controllers/camaleon_cms/admin/appearances/nav_menus_controller.rb +11 -6
  10. data/app/controllers/camaleon_cms/admin/appearances/themes_controller.rb +6 -0
  11. data/app/controllers/camaleon_cms/admin/media_controller.rb +3 -0
  12. data/app/controllers/camaleon_cms/admin/users_controller.rb +3 -0
  13. data/app/controllers/camaleon_cms/camaleon_controller.rb +5 -0
  14. data/app/controllers/camaleon_cms/frontend_controller.rb +1 -1
  15. data/app/controllers/concerns/camaleon_cms/frontend_concern.rb +1 -1
  16. data/app/decorators/camaleon_cms/site_decorator.rb +1 -1
  17. data/app/decorators/camaleon_cms/user_decorator.rb +4 -0
  18. data/app/helpers/camaleon_cms/admin/custom_fields_helper.rb +4 -4
  19. data/app/helpers/camaleon_cms/camaleon_helper.rb +5 -0
  20. data/app/helpers/camaleon_cms/frontend/nav_menu_helper.rb +16 -16
  21. data/app/helpers/camaleon_cms/hooks_helper.rb +10 -4
  22. data/app/helpers/camaleon_cms/plugins_helper.rb +1 -1
  23. data/app/helpers/camaleon_cms/session_helper.rb +9 -4
  24. data/app/helpers/camaleon_cms/short_code_helper.rb +1 -1
  25. data/app/helpers/camaleon_cms/theme_helper.rb +1 -1
  26. data/app/helpers/camaleon_cms/uploader_helper.rb +10 -7
  27. data/app/mailers/camaleon_cms/html_mailer.rb +33 -17
  28. data/app/models/camaleon_cms/ability.rb +2 -2
  29. data/app/models/camaleon_cms/nav_menu.rb +2 -2
  30. data/app/models/camaleon_cms/nav_menu_item.rb +5 -3
  31. data/app/models/camaleon_cms/site.rb +5 -101
  32. data/app/models/camaleon_cms/user.rb +8 -144
  33. data/app/models/camaleon_cms/user_relationship.rb +1 -1
  34. data/app/models/camaleon_cms/user_role.rb +0 -2
  35. data/app/models/concerns/camaleon_cms/custom_fields_read.rb +14 -7
  36. data/app/models/concerns/camaleon_cms/metas.rb +5 -4
  37. data/app/models/concerns/camaleon_cms/site_default_settings.rb +87 -0
  38. data/app/models/concerns/camaleon_cms/user_methods.rb +142 -0
  39. data/app/uploaders/camaleon_cms_aws_uploader.rb +13 -4
  40. data/app/uploaders/camaleon_cms_uploader.rb +3 -1
  41. data/app/views/camaleon_cms/admin/appearances/nav_menus/_custom_menus.html.erb +11 -5
  42. data/app/views/camaleon_cms/admin/appearances/nav_menus/_external_menu.html.erb +8 -0
  43. data/app/views/camaleon_cms/admin/settings/_media_settings.html.erb +4 -0
  44. data/app/views/camaleon_cms/admin/settings/custom_fields/_get_items.html.erb +155 -154
  45. data/app/views/camaleon_cms/admin/settings/custom_fields/_render.html.erb +1 -1
  46. data/app/views/camaleon_cms/admin/settings/custom_fields/fields/_checkbox.html.erb +1 -1
  47. data/app/views/camaleon_cms/admin/settings/custom_fields/fields/_checkboxes.html.erb +1 -1
  48. data/app/views/camaleon_cms/admin/settings/custom_fields/fields/_posts.html.erb +2 -5
  49. data/app/views/camaleon_cms/admin/settings/custom_fields/form.html.erb +1 -1
  50. data/app/views/camaleon_cms/admin/settings/post_types/_form.html.erb +24 -16
  51. data/app/views/camaleon_cms/admin/users/form.html.erb +2 -2
  52. data/app/views/camaleon_cms/default_theme/single.html.erb +1 -1
  53. data/app/views/layouts/camaleon_cms/admin.html.erb +2 -2
  54. data/config/initializers/model_alias.rb +10 -3
  55. data/config/locales/camaleon_cms/admin/en.yml +10 -0
  56. data/config/locales/camaleon_cms/admin/fr.yml +663 -0
  57. data/config/locales/camaleon_cms/common.yml +66 -0
  58. data/config/routes/frontend.rb +1 -1
  59. data/config/system.json +2 -2
  60. data/db/migrate/20150611161134_post_table_into_utf8.rb +6 -5
  61. data/lib/camaleon_cms/engine.rb +3 -0
  62. data/lib/camaleon_cms/version.rb +1 -1
  63. data/lib/ext/string.rb +1 -54
  64. data/lib/plugin_routes.rb +5 -0
  65. data/spec/decorators/post_type_spec.rb +13 -0
  66. data/spec/dummy/README.rdoc +28 -0
  67. data/spec/dummy/Rakefile +6 -0
  68. data/spec/dummy/app/assets/javascripts/application.js +13 -0
  69. data/spec/dummy/app/assets/stylesheets/application.css +15 -0
  70. data/spec/dummy/app/controllers/application_controller.rb +5 -0
  71. data/spec/dummy/app/helpers/application_helper.rb +2 -0
  72. data/spec/dummy/app/views/layouts/application.html.erb +14 -0
  73. data/spec/dummy/bin/bundle +3 -0
  74. data/spec/dummy/bin/rails +4 -0
  75. data/spec/dummy/bin/rake +4 -0
  76. data/spec/dummy/bin/setup +29 -0
  77. data/spec/dummy/config.ru +4 -0
  78. data/spec/dummy/config/application.rb +26 -0
  79. data/spec/dummy/config/boot.rb +5 -0
  80. data/spec/dummy/config/database.yml +25 -0
  81. data/spec/dummy/config/environment.rb +5 -0
  82. data/spec/dummy/config/environments/development.rb +41 -0
  83. data/spec/dummy/config/environments/production.rb +79 -0
  84. data/spec/dummy/config/environments/test.rb +42 -0
  85. data/spec/dummy/config/initializers/assets.rb +11 -0
  86. data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
  87. data/spec/dummy/config/initializers/cookies_serializer.rb +3 -0
  88. data/spec/dummy/config/initializers/filter_parameter_logging.rb +4 -0
  89. data/spec/dummy/config/initializers/inflections.rb +16 -0
  90. data/spec/dummy/config/initializers/mime_types.rb +4 -0
  91. data/spec/dummy/config/initializers/session_store.rb +3 -0
  92. data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
  93. data/spec/dummy/config/locales/en.yml +23 -0
  94. data/spec/dummy/config/routes.rb +4 -0
  95. data/spec/dummy/config/secrets.yml +22 -0
  96. data/spec/dummy/db/development.sqlite3 +0 -0
  97. data/spec/dummy/db/schema.rb +186 -0
  98. data/spec/dummy/public/404.html +67 -0
  99. data/spec/dummy/public/422.html +67 -0
  100. data/spec/dummy/public/500.html +66 -0
  101. data/spec/dummy/public/favicon.ico +0 -0
  102. data/spec/features/categories_spec.rb +25 -0
  103. data/spec/features/comments_spec.rb +45 -0
  104. data/spec/features/contact_form_spec.rb +53 -0
  105. data/spec/features/content_groups_spec.rb +45 -0
  106. data/spec/features/custom_fields_spec.rb +47 -0
  107. data/spec/features/frontend/pages_spec.rb +5 -0
  108. data/spec/features/languages_spec.rb +27 -0
  109. data/spec/features/media_spec.rb +50 -0
  110. data/spec/features/menus_spec.rb +46 -0
  111. data/spec/features/pages_spec.rb +30 -0
  112. data/spec/features/plugins_spec.rb +29 -0
  113. data/spec/features/posts_spec.rb +36 -0
  114. data/spec/features/session_spec.rb +52 -0
  115. data/spec/features/settings_spec.rb +17 -0
  116. data/spec/features/shortcodes_spec.rb +11 -0
  117. data/spec/features/sites_spec.rb +45 -0
  118. data/spec/features/tags_spec.rb +25 -0
  119. data/spec/features/themes_spec.rb +18 -0
  120. data/spec/features/user_roles_spec.rb +60 -0
  121. data/spec/features/users_spec.rb +79 -0
  122. data/spec/features/widgets_spec.rb +50 -0
  123. data/spec/helpers/email_helper_spec.rb +16 -0
  124. data/spec/mailers/send_mail_spec.rb +37 -0
  125. data/spec/rails_helper.rb +1 -0
  126. data/spec/routing/post_type_routes_spec.rb +12 -0
  127. data/spec/spec_helper.rb +191 -0
  128. data/spec/support/common.rb +113 -0
  129. data/spec/support/wait_for_ajax.rb +36 -0
  130. metadata +326 -3
@@ -0,0 +1,50 @@
1
+ require "rails_helper"
2
+ describe "the Media", js: true do
3
+ login_success
4
+
5
+ it "list media" do
6
+ admin_sign_in
7
+ visit "#{cama_root_relative_path}/admin/media"
8
+ within '#cama_media_gallery' do
9
+ execute_script("$('#cama_search_form .dropdown-toggle.btn').click()")
10
+ find('.add_folder').click
11
+ end
12
+
13
+ within '#add_folder_form' do
14
+ fill_in "folder", with: "test_folder_created_by_testing"
15
+ find('button[type="submit"]').click
16
+ wait_for_ajax
17
+ end
18
+ expect(page).to have_content('test_folder_created_by_testing')
19
+
20
+ within '#cama_media_gallery' do
21
+ # access into inner folder
22
+ page.execute_script("$('#cama_media_gallery .folder_item[data-key=\"test_folder_created_by_testing\"]').click()")
23
+ wait_for_ajax
24
+ # attach_file('cama-upload-files', Rails.root.join('config', 'system.json').to_s)
25
+
26
+ within '#cama_media_external' do
27
+ fill_in "remote_file", with: "http://camaleon.tuzitio.com/media/132/slider/slider-camaleon.jpg"
28
+ find('button[type="submit"]').click
29
+ wait_for_ajax
30
+ end
31
+ end
32
+
33
+ # expect(page).to have_content('slider-camaleon.jpg')
34
+
35
+ # delete uploaded file
36
+ page.execute_script("$('#cama_media_gallery .file_item[data-key=\"slider_camaleon.jpg\"] .del_item').click()")
37
+ page.driver.browser.switch_to.alert.accept
38
+ wait_for_ajax
39
+
40
+ # back to root
41
+ page.execute_script("$('#cama_media_gallery .media_folder_breadcrumb a:first').click()")
42
+ wait_for_ajax
43
+
44
+ # delete folder
45
+ page.execute_script("$('#cama_media_gallery .folder_item[data-key=\"test_folder_created_by_testing\"] .del_folder').click()")
46
+ page.driver.browser.switch_to.alert.accept
47
+ wait_for_ajax
48
+
49
+ end
50
+ end
@@ -0,0 +1,46 @@
1
+ require "rails_helper"
2
+ describe "the Menus", js: true do
3
+ login_success
4
+
5
+ it "Menus list" do
6
+ admin_sign_in
7
+ visit "#{cama_root_relative_path}/admin/appearances/nav_menus"
8
+ expect(page).to have_css('#menu_content')
9
+ within "#menu_items" do
10
+ # post menus
11
+ check("Sample Post")
12
+ page.execute_script('$("#acc-post input").prop("checked", true)')
13
+ page.execute_script('$("#acc-post").prev().find("input").prop("checked", true)')
14
+ page.execute_script('$("#acc-post .add_links_to_menu").click()')
15
+ wait_for_ajax
16
+
17
+ # custom links
18
+ all(".panel-collapse").last.click
19
+ wait(3)
20
+ within ".form-custom-link" do
21
+ fill_in "external_label", with: "name link"
22
+ fill_in "external_url", with: "http://mytest.com"
23
+ find("#add_external_link").click
24
+ wait_for_ajax
25
+ end
26
+ end
27
+
28
+ within '#menus_list' do
29
+ all('.delete_menu_item').each do |btn|
30
+ btn.click
31
+ page.driver.browser.switch_to.alert.accept
32
+ wait_for_ajax
33
+ end
34
+ end
35
+
36
+ end
37
+
38
+ it "Menus Create and Delete" do
39
+ admin_sign_in
40
+ visit "#{cama_root_relative_path}/admin/appearances/nav_menus"
41
+ page.execute_script('$("#switch_nav_menu_form .btn-danger").click()')
42
+ page.driver.browser.switch_to.alert.accept
43
+ expect(page).to have_css('.alert-success')
44
+ end
45
+
46
+ end
@@ -0,0 +1,30 @@
1
+ require "rails_helper"
2
+ describe "the signin process", js: true do
3
+ login_success
4
+
5
+ it "create new page" do
6
+ admin_sign_in
7
+ visit "#{cama_root_relative_path}/admin/post_type/7/posts/new"
8
+ within("#form-post") do
9
+ fill_in 'post_title', :with => 'Test Title'
10
+ page.execute_script('$("#form-post .required").val("test required value")')
11
+ page.execute_script('$("#form-post .tinymce_textarea").tinymce().setContent("Pants are pretty sweet.")')
12
+
13
+ fill_in 'post_keywords', :with => 'test keywords'
14
+ end
15
+ click_button 'Create'
16
+ expect(page).to have_css('.alert-success')
17
+ end
18
+
19
+ it "create edit page" do
20
+ admin_sign_in
21
+ visit "#{cama_root_relative_path}/admin/post_type/7/posts/#{get_content_attr("page", "id", "last")}/edit"
22
+ within("#form-post") do
23
+ fill_in 'post_title', :with => 'Test Title changed'
24
+ page.execute_script('$("#form-post .tinymce_textarea").tinymce().setContent("Pants are pretty sweet. chaged")')
25
+ fill_in 'post_keywords', :with => 'test keywords changed'
26
+ end
27
+ click_button 'Update'
28
+ expect(page).to have_css('.alert-success')
29
+ end
30
+ end
@@ -0,0 +1,29 @@
1
+ require "rails_helper"
2
+ describe "the Menus", js: true do
3
+ login_success
4
+
5
+ it "Plugins list" do
6
+ admin_sign_in
7
+ visit "#{cama_root_relative_path}/admin/plugins"
8
+ expect(page).to have_css('#table-plugins-list')
9
+ expect(page).to have_content("Attack")
10
+ expect(page).to have_content("Contact Form")
11
+ expect(page).to have_content("Front Cache")
12
+ expect(page).to have_content("Active")
13
+
14
+ # uninstall plugin
15
+ within '#tab_plugins_active' do
16
+ all(".btn-default")[0].click
17
+ end
18
+ page.driver.browser.switch_to.alert.accept
19
+ expect(page).to have_css('.alert-success')
20
+
21
+ # install plugin
22
+ page.execute_script('$("#table-plugins-list .nav-tabs li").eq(1).find("a").click()')
23
+ within '#tab_plugins_disabled' do
24
+ all(".btn-default")[0].click
25
+ end
26
+ page.driver.browser.switch_to.alert.accept
27
+ expect(page).to have_css('.alert-success')
28
+ end
29
+ end
@@ -0,0 +1,36 @@
1
+ require "rails_helper"
2
+ describe "the signin process", js: true do
3
+ login_success
4
+
5
+ it "create new post" do
6
+ admin_sign_in
7
+ visit "#{cama_root_relative_path}/admin/post_type/2/posts/new"
8
+ within("#form-post") do
9
+ fill_in 'post_title', :with => 'Test Title'
10
+ page.execute_script('$("#form-post .tinymce_textarea").tinymce().setContent("Pants are pretty sweet.")')
11
+ page.execute_script('$("#form-post input[name=\'categories[]\']:first").prop("checked", true)')
12
+ wait(20)
13
+ fill_in 'post_summary', :with => 'test summary'
14
+ fill_in 'post_keywords', :with => 'test keywords'
15
+ page.execute_script("$('#form-post input[name=\"tags\"]').val('owen,dota')")
16
+ end
17
+ click_button 'Create'
18
+ expect(page).to have_css('.alert-success')
19
+ end
20
+
21
+ it "create edit post" do
22
+ admin_sign_in
23
+ visit "#{cama_root_relative_path}/admin/post_type/2/posts/#{get_content_attr("post", "id", "last")}/edit"
24
+ within("#form-post") do
25
+ fill_in 'post_title', :with => 'Test Title changed'
26
+ page.execute_script('$("#form-post .tinymce_textarea").tinymce().setContent("Pants are pretty sweet. chaged")')
27
+ fill_in 'post_summary', :with => 'test summary changed'
28
+ fill_in 'post_keywords', :with => 'test keywords changed'
29
+ end
30
+ click_button 'Update'
31
+ expect(page).to have_css('.alert-success')
32
+ # visit page in frontend
33
+ visit "#{get_content_attr("post", "the_path", "last")}"
34
+ expect(page).to have_content("Test Title changed")
35
+ end
36
+ end
@@ -0,0 +1,52 @@
1
+ require "rails_helper"
2
+ describe "the signin process", js: true do
3
+
4
+ login_success
5
+
6
+ it "signs me in not valid" do
7
+ visit "#{cama_root_relative_path}/admin/login"
8
+ within("#login_user") do
9
+ fill_in 'user_username', :with => 'admin'
10
+ fill_in 'user_password', :with => 'ADMIN'
11
+ end
12
+ click_button 'Log In'
13
+ expect(page).to have_css('#user_username')
14
+ end
15
+
16
+ it "forgot pass" do
17
+ visit "#{cama_root_relative_path}/admin/forgot"
18
+ within("#login_user") do
19
+ fill_in 'user_email', :with => 'admin@local.com'
20
+ end
21
+ click_button 'Submit'
22
+ expect(page).to have_content 'Send email reset success'
23
+ end
24
+
25
+ it "Enable Register" do
26
+ visit "#{cama_root_relative_path}/admin/settings/site?tab=config" do
27
+ within '#site_settings_form' do
28
+ check "meta_permit_create_account"
29
+ click_button 'Submit'
30
+ end
31
+ end
32
+ expect(page).to have_css('.alert-success')
33
+ end
34
+
35
+
36
+ it "Register User" do
37
+ visit "#{cama_root_relative_path}/admin/register"
38
+ within("#login_user") do
39
+ fill_in 'meta[first_name]', :with => 'Name'
40
+ fill_in 'meta[last_name]', :with => 'Last Name'
41
+ fill_in 'user[email]', :with => 'test@tester.com'
42
+ fill_in 'user[username]', :with => 'tester'
43
+ fill_in 'user[username]', :with => 'tester'
44
+ fill_in 'user[password]', :with => 'passswor'
45
+ fill_in 'user[password_confirmation]', :with => 'passswor'
46
+ fill_in 'user[password_confirmation]', :with => 'passswor'
47
+ fill_in 'captcha', :with => 'passswor'
48
+ end
49
+ click_button 'Sign Up'
50
+ expect(page).to have_css('.alert-success')
51
+ end
52
+ end
@@ -0,0 +1,17 @@
1
+ require "rails_helper"
2
+ describe "the Site Settings", js: true do
3
+ login_success
4
+
5
+ it "Settings Form" do
6
+ admin_sign_in
7
+ visit "#{cama_root_relative_path}/admin/settings/site"
8
+ expect(page).to have_content("Basic Information")
9
+ expect(page).to have_content("Configuration")
10
+ within '#site_settings_form' do
11
+ fill_in "site_name", with: 'New site title'
12
+ fill_in "site_description", with: 'Site description'
13
+ click_button "Submit"
14
+ end
15
+ expect(page).to have_css('.alert-success')
16
+ end
17
+ end
@@ -0,0 +1,11 @@
1
+ require "rails_helper"
2
+ describe "the Shortcodes", js: true do
3
+ login_success
4
+
5
+ it "Shortcodes list" do
6
+ admin_sign_in
7
+ visit "#{cama_root_relative_path}/admin/settings/shortcodes"
8
+ expect(page).to have_content('Short Code')
9
+ end
10
+
11
+ end
@@ -0,0 +1,45 @@
1
+ require "rails_helper"
2
+ describe "the Sites", js: true do
3
+ login_success
4
+
5
+ it "Sites list" do
6
+ admin_sign_in
7
+ visit "#{cama_root_relative_path}/admin/settings/sites"
8
+ expect(page).to have_content("List Sites")
9
+
10
+ # create user role
11
+ within '#admin_content' do
12
+ click_link "Add Site"
13
+ end
14
+ expect(page).to have_css("#new_site")
15
+ within '#new_site' do
16
+ fill_in "site_slug", with: 'owen'
17
+ fill_in "site_name", with: 'Owen sub site'
18
+ click_button "Submit"
19
+ end
20
+ expect(page).to have_css('.alert-success')
21
+ end
22
+
23
+ it "Site Edit" do
24
+ admin_sign_in
25
+ visit "#{cama_root_relative_path}/admin/settings/sites"
26
+ within '#admin_content' do
27
+ all(".btn-default").last.click
28
+ end
29
+ within '#edit_site' do
30
+ fill_in "site_name", with: 'Owen Site Title changed'
31
+ click_button "Submit"
32
+ end
33
+ expect(page).to have_css('.alert-success')
34
+ end
35
+
36
+ it "Site destroy" do
37
+ admin_sign_in
38
+ visit "#{cama_root_relative_path}/admin/settings/sites"
39
+ within '#admin_content' do
40
+ all(".btn-danger").last.click
41
+ end
42
+ page.driver.browser.switch_to.alert.accept
43
+ expect(page).to have_css('.alert-success')
44
+ end
45
+ end
@@ -0,0 +1,25 @@
1
+ require "rails_helper"
2
+ describe "the signin process", js: true do
3
+ login_success
4
+
5
+ it "create new tag" do
6
+ admin_sign_in
7
+ visit "#{cama_root_relative_path}/admin/post_type/2/post_tags"
8
+ within("#new_post_tag") do
9
+ fill_in 'post_tag_name', :with => 'Test tag'
10
+ fill_in 'post_tag_slug', :with => 'test-tag'
11
+ end
12
+ click_button 'Submit'
13
+ expect(page).to have_css('.alert-success')
14
+ end
15
+
16
+ it "create edit tag" do
17
+ admin_sign_in
18
+ visit "#{cama_root_relative_path}/admin/post_type/2/post_tags/#{get_tag_attr("id", "last")}/edit"
19
+ within("#edit_post_tag") do
20
+ fill_in 'post_tag_name', :with => 'Test tag update'
21
+ end
22
+ click_button 'Submit'
23
+ expect(page).to have_css('.alert-success')
24
+ end
25
+ end
@@ -0,0 +1,18 @@
1
+ require "rails_helper"
2
+ describe "the Themes", js: true do
3
+ login_success
4
+
5
+ it "Themes list" do
6
+ admin_sign_in
7
+ visit "#{cama_root_relative_path}/admin/appearances/themes"
8
+ expect(page).to have_css('#themes_page')
9
+ within "#themes_page" do
10
+ first('.preview_link').click
11
+ end
12
+ # wait_for_ajax
13
+ # page.within_frame '#ow_inline_modal_iframe' do
14
+ # page.should have_selector 'body'
15
+ # end
16
+ end
17
+
18
+ end
@@ -0,0 +1,60 @@
1
+ require "rails_helper"
2
+ describe "the User Roles", js: true do
3
+ login_success
4
+
5
+ it "User Roles list" do
6
+ admin_sign_in
7
+ visit "#{cama_root_relative_path}/admin/user_roles"
8
+ expect(page).to have_content("User Roles")
9
+ expect(page).to have_content("Administrator")
10
+ expect(page).to have_content("Editor")
11
+ expect(page).to have_content("Contributor")
12
+
13
+ # create user role
14
+ within '#admin_content' do
15
+ click_link "Add User Role"
16
+ end
17
+ expect(page).to have_css("#new_user_role")
18
+ within '#new_user_role' do
19
+ fill_in "user_role_name", with: 'Test Role'
20
+ fill_in "user_role_slug", with: 'tester-role'
21
+ fill_in "user_role_description", with: 'tester descr'
22
+ check "Comments"
23
+ check "Themes"
24
+ click_button "Submit"
25
+ end
26
+ expect(page).to have_css('.alert-success')
27
+ end
28
+
29
+ # TODO verification of all roles
30
+ # it "Users Verify Role" do
31
+ # admin_sign_in(false, "tester", "tester")
32
+ # end
33
+
34
+ it "User Role Edit" do
35
+ admin_sign_in
36
+ visit "#{cama_root_relative_path}/admin/user_roles"
37
+ within '#admin_content' do
38
+ all(".btn-default").last.click
39
+ end
40
+ expect(page).to have_checked_field("Themes")
41
+ within '#edit_user_role' do
42
+ fill_in "user_role_name", with: 'Test Role updated'
43
+ fill_in "user_role_slug", with: 'tester-role-updated'
44
+ fill_in "user_role_description", with: 'tester descr updated'
45
+ check "Settings"
46
+ click_button "Submit"
47
+ end
48
+ expect(page).to have_css('.alert-success')
49
+ end
50
+
51
+ it "User Group destroy" do
52
+ admin_sign_in
53
+ visit "#{cama_root_relative_path}/admin/user_roles"
54
+ within '#admin_content' do
55
+ all(".btn-danger").last.click
56
+ end
57
+ page.driver.browser.switch_to.alert.accept
58
+ expect(page).to have_css('.alert-success')
59
+ end
60
+ end
@@ -0,0 +1,79 @@
1
+ require "rails_helper"
2
+ describe "the Users", js: true do
3
+ login_success
4
+
5
+ it "Users list" do
6
+ admin_sign_in
7
+ visit "#{cama_root_relative_path}/admin/users"
8
+ expect(page).to have_content("List Users")
9
+
10
+ # create user
11
+ within '#admin_content' do
12
+ click_link "Add User"
13
+ end
14
+ expect(page).to have_content("Create User")
15
+ within '#user_form' do
16
+ fill_in "user[first_name]", with: 'Test'
17
+ fill_in "user[last_name]", with: 'Test Last name'
18
+ fill_in "meta[slogan]", with: 'My slogan'
19
+ fill_in "user[username]", with: 'tester'
20
+ fill_in "user[email]", with: 'tester@gmail.com'
21
+ fill_in "user[password]", with: 'tester'
22
+ fill_in "user[password_confirmation]", with: 'tester'
23
+ find(".user-form-left").click_button "Create"
24
+ end
25
+ expect(page).to have_css('.alert-success')
26
+ expect(page).to have_content("tester")
27
+ end
28
+
29
+ it "Users login new user" do
30
+ admin_sign_in(false, "tester", "tester")
31
+ end
32
+
33
+ it "Users Edit" do
34
+ admin_sign_in
35
+ visit "#{cama_root_relative_path}/admin/users"
36
+ within '#admin_content' do
37
+ all(".btn-default")[1].click
38
+ end
39
+ within '#user_form' do
40
+ fill_in "user[first_name]", with: 'Test updated'
41
+ fill_in "user[last_name]", with: 'Test Last name udpated'
42
+ fill_in "meta[slogan]", with: 'My slogan updated'
43
+ fill_in "user[username]", with: 'tester-updated'
44
+ fill_in "user[email]", with: 'tester_updated@gmail.com'
45
+ find(".user-form-left").click_button "Update"
46
+ end
47
+ # wait(30)
48
+ expect(page).to have_css('.alert-success')
49
+ end
50
+
51
+ it "Users Update Pass" do
52
+ admin_sign_in
53
+ visit "#{cama_root_relative_path}/admin/users"
54
+ within '#admin_content' do
55
+ all(".btn-default")[1].click
56
+ end
57
+ within '#user_form' do
58
+ click_link "Change Password"
59
+ end
60
+ wait_for_ajax
61
+ within '#profie-form-ajax-password' do
62
+ fill_in 'password[password]', with: "tester_new"
63
+ fill_in 'password[password_confirmation]', with: "tester_new"
64
+ click_button "Proccess"
65
+ end
66
+ wait_for_ajax
67
+ expect(page).to have_css('.alert-success')
68
+ end
69
+
70
+ it "Users destroy" do
71
+ admin_sign_in
72
+ visit "#{cama_root_relative_path}/admin/users"
73
+ within '#admin_content' do
74
+ all(".btn-danger")[1].click
75
+ end
76
+ page.driver.browser.switch_to.alert.accept
77
+ expect(page).to have_css('.alert-success')
78
+ end
79
+ end