camaleon_cms 2.4.5.13 → 2.4.5.14

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.

checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4b5b841bdb1ed06f9f3ba65d2cd89e1a7bd9f5e40752d1f4933ff4e2887613be
4
- data.tar.gz: e62d7c3127ff0707db4057f3aa6841cc3b1fdaf849cb117a01264ef0e34b237b
3
+ metadata.gz: fc0ebfaaa321010561d4583a38122cb11c97e98aec6b88d302e697c360485bcb
4
+ data.tar.gz: e820315d99ea44d5ea52bdb85a07eeeaf224da7cce8e4d350ba8b09120401a50
5
5
  SHA512:
6
- metadata.gz: 948fabc9666e87b36806fca7fb2241365f011879f902bdb5c54d651c6b38f9c220ea2158d9717ea141d0f516bc37c0e30a5bbf5e148f27a88187969f639cf42c
7
- data.tar.gz: 9e1d8973b375de51b6f8ab39d5bbd779372ad828ce29eff92049c852cc9b940492aa1f67552499380f98bac30f7cb54620784125786aaad09b3ae8aa7174a2af
6
+ metadata.gz: 11eab3a425b657bd240e2cdfa6497257d190dd3fe424c93341b490fab2a8d837afe8fa2ee9f2de4386044e8ef9c66acd2e8a353bce5e94b6eabd92b7bd89e845
7
+ data.tar.gz: 948f09e2d26e83ef2defb827fb200bda1d284714c56ff6e21c5ac77660b31a3a953252fed523ec7db6aadbb5ac657541b45f1af3c32fcc5d7cae502660ebdea4
@@ -176,7 +176,7 @@ class CamaleonCms::FrontendController < CamaleonCms::CamaleonController
176
176
  @comments = @post.the_comments
177
177
  @categories = @post.the_categories
178
178
  @post.increment_visits!
179
-
179
+
180
180
  home_page = @_site_options[:home_page] rescue nil
181
181
  if lookup_context.template_exists?("page_#{@post.id}")
182
182
  r_file = "page_#{@post.id}"
@@ -197,9 +197,9 @@ class CamaleonCms::FrontendController < CamaleonCms::CamaleonController
197
197
  layout_ = meta_layout if meta_layout.present? && lookup_context.template_exists?("layouts/#{meta_layout}")
198
198
  r = {post: @post, post_type: @post_type, layout: layout_, render: r_file}
199
199
  hooks_run("on_render_post", r) if from_url
200
-
200
+
201
201
  if status.present?
202
- render r[:render], (!r[:layout].nil? ? {layout: r[:layout], status: status} : {status: status})
202
+ render r[:render], (!r[:layout].nil? ? {layout: r[:layout], status: status} : {status: status})
203
203
  else
204
204
  render r[:render], (!r[:layout].nil? ? {layout: r[:layout]} : {})
205
205
  end
@@ -209,7 +209,7 @@ class CamaleonCms::FrontendController < CamaleonCms::CamaleonController
209
209
 
210
210
  # render error page
211
211
  def page_not_found()
212
- if @_site_options[:error_404].present? # render a custom error page
212
+ if @_site_options[:error_404].present? && request.format.html? # render a custom error page
213
213
  page_404 = current_site.posts.find(@_site_options[:error_404]) rescue ""
214
214
  if page_404.present?
215
215
  render_post(page_404, false, :not_found)
@@ -124,9 +124,7 @@ module CamaleonCms::SessionHelper
124
124
  c = cookies[:auth_token].split("&")
125
125
  return nil unless c.size == 3
126
126
 
127
- if c[1] == request.user_agent.to_s && request.ip == c[2]
128
- @cama_current_user = current_site.users_include_admins.find_by_auth_token(c[0]).try(:decorate)
129
- end
127
+ @cama_current_user = current_site.users_include_admins.find_by_auth_token(c[0]).try(:decorate)
130
128
  end
131
129
 
132
130
  # check if a visitor was logged in
@@ -3,7 +3,7 @@ class AdjustFieldLength < CamaManager.migration_class
3
3
  change_column "#{PluginRoutes.static_system_info["db_prefix"]}posts", :title, :text
4
4
  remove_index "#{PluginRoutes.static_system_info["db_prefix"]}posts", :slug
5
5
  change_column "#{PluginRoutes.static_system_info["db_prefix"]}posts", :slug, :text
6
- add_index "#{PluginRoutes.static_system_info["db_prefix"]}posts", :slug, length: 1000
6
+ add_index "#{PluginRoutes.static_system_info["db_prefix"]}posts", :slug, length: 500
7
7
  change_column "#{PluginRoutes.static_system_info["db_prefix"]}term_taxonomy", :name, :text
8
8
  end
9
9
  end
@@ -1,3 +1,3 @@
1
1
  module CamaleonCms
2
- VERSION = '2.4.5.13'
2
+ VERSION = '2.4.5.14'
3
3
  end
@@ -80,7 +80,7 @@ describe "the signin process", js: true do
80
80
  @site.set_option('security_captcha_user_register', true) # enable captcha security for user registration
81
81
  Capybara.using_session("test session") do
82
82
  visit cama_captcha_path(len: 4, t: Time.current.to_i)
83
- captcha = page.get_rack_session['cama_captcha']
83
+ captcha = page.get_rack_session['cama_captcha'].first
84
84
  visit "#{cama_root_relative_path}/admin/register"
85
85
  within("#login_user") do
86
86
  fill_in 'user[first_name]', :with => 'Name'
@@ -95,8 +95,8 @@ describe "the signin process", js: true do
95
95
  expect(page).to have_css('.alert-success')
96
96
  end
97
97
  end
98
-
98
+
99
99
  end
100
100
 
101
-
102
- end
101
+
102
+ end
@@ -7,7 +7,7 @@ describe "Post frontend", js: true do
7
7
  visit @post.the_url(as_path: true)
8
8
  expect(page).to have_text(@post.the_title)
9
9
  end
10
-
10
+
11
11
  describe 'comments' do
12
12
 
13
13
  describe 'anonymous' do
@@ -33,7 +33,7 @@ describe "Post frontend", js: true do
33
33
  @site.set_option('enable_captcha_for_comments', true) # enable anonymous captcha
34
34
  Capybara.using_session("test session") do
35
35
  visit cama_captcha_path(len: 4, t: Time.current.to_i)
36
- captcha = page.get_rack_session['cama_captcha']
36
+ captcha = page.get_rack_session['cama_captcha'].first
37
37
  visit @post.the_url(as_path: true)
38
38
  expect(page).to have_text('New Comment')
39
39
  within("#form-comment") do
@@ -81,36 +81,36 @@ describe "Post frontend", js: true do
81
81
  expect(page).not_to have_text('New Comment')
82
82
  end
83
83
  end
84
-
84
+
85
85
  describe 'post visibility' do
86
86
  before(:each) do
87
87
  current_site(@site)
88
88
  plugin_install('visibility_post')
89
89
  end
90
-
90
+
91
91
  it 'public post' do
92
92
  custom_post = create(:post, site: @site).decorate
93
93
  visit custom_post.the_url(as_path: true)
94
- expect(page).to have_http_status(:success)
94
+ expect(page).not_to have_text('does not exist')
95
95
  end
96
96
 
97
97
  it 'public future post with login' do
98
98
  custom_post = create(:post, site: @site, published_at: 1.day.from_now).decorate
99
99
  admin_sign_in(custom_post.owner.username, '12345678')
100
100
  visit custom_post.the_url(as_path: true)
101
- expect(page).to have_http_status(:not_found)
101
+ expect(page).to have_text('does not exist')
102
102
  end
103
103
 
104
104
  it 'public future post without login' do
105
105
  custom_post = create(:post, site: @site, published_at: 1.day.from_now).decorate
106
106
  visit custom_post.the_url(as_path: true)
107
- expect(page).to have_http_status(:not_found)
107
+ expect(page).to have_text('does not exist')
108
108
  end
109
109
 
110
110
  it 'private post without login ' do
111
111
  custom_post = create(:private_post, site: @site).decorate
112
112
  visit custom_post.the_url(as_path: true)
113
- expect(page).to have_http_status(:not_found)
113
+ expect(page).to have_text('does not exist')
114
114
  end
115
115
 
116
116
  it 'private post with login' do
@@ -118,7 +118,7 @@ describe "Post frontend", js: true do
118
118
  custom_post = create(:private_post, site: @site, owner: user).decorate
119
119
  admin_sign_in(user.username, '12345678')
120
120
  visit custom_post.the_url(as_path: true)
121
- expect(page).to have_http_status(:success)
121
+ expect(page).not_to have_text('does not exist')
122
122
  end
123
123
 
124
124
  it 'password post without password ' do
@@ -130,7 +130,7 @@ describe "Post frontend", js: true do
130
130
  it 'password post with password ' do
131
131
  custom_post = create(:password_post, site: @site).decorate
132
132
  visit custom_post.the_url(as_path: true, post_password: custom_post.visibility_value)
133
- expect(page).to have_http_status(:success)
133
+ expect(page).not_to have_text('does not exist')
134
134
  end
135
135
  end
136
- end
136
+ end
data/spec/rails_helper.rb CHANGED
@@ -1,38 +1,7 @@
1
1
  require 'spec_helper'
2
- require 'transactional_capybara/rspec'
3
2
 
4
- # spec/support/factory_bot.rb
5
3
  RSpec.configure do |config|
6
4
  config.include FactoryBot::Syntax::Methods
7
- end
8
-
9
- # RSpec without Rails
10
- RSpec.configure do |config|
11
- config.include FactoryBot::Syntax::Methods
12
-
13
- config.before(:suite) do
14
- FactoryBot.find_definitions
15
- end
16
- end
17
-
18
- # rspec cleaner
19
- RSpec.configure do |config|
20
-
21
- config.before(:suite) do
22
- DatabaseCleaner.strategy = :transaction
23
- DatabaseCleaner.clean_with(:truncation)
24
- end
25
-
26
- config.around(:each) do |example|
27
- DatabaseCleaner.cleaning do
28
- example.run
29
- end
30
- end
31
-
32
- end
33
-
34
- # capyobara cleaner
35
- RSpec.configure do |config|
36
5
 
37
6
  config.use_transactional_fixtures = false
38
7
 
@@ -49,6 +18,8 @@ RSpec.configure do |config|
49
18
  uncommitted transaction data setup over the spec's database connection.
50
19
  MSG
51
20
  end
21
+ FactoryBot.find_definitions
22
+ DatabaseCleaner.strategy = :transaction
52
23
  DatabaseCleaner.clean_with(:truncation)
53
24
  end
54
25
 
@@ -76,5 +47,4 @@ RSpec.configure do |config|
76
47
  config.append_after(:each) do
77
48
  DatabaseCleaner.clean
78
49
  end
79
-
80
- end
50
+ end
data/spec/spec_helper.rb CHANGED
@@ -11,8 +11,6 @@ require 'rspec/rails'
11
11
  require "capybara/rspec"
12
12
  require 'database_cleaner'
13
13
  require "rack_session_access/capybara"
14
-
15
- require 'capybara/rspec'
16
14
  require 'capybara-screenshot/rspec'
17
15
 
18
16
  if defined?(Capybara::Webkit)
@@ -35,7 +33,7 @@ if defined?(Capybara::Webkit)
35
33
 
36
34
  Capybara.javascript_driver = :webkit
37
35
  else
38
- Capybara.javascript_driver = :selenium
36
+ Capybara.javascript_driver = :selenium_chrome_headless
39
37
  end
40
38
 
41
39
  # define screenshot errors name
@@ -64,10 +64,10 @@ end
64
64
 
65
65
  # fix for: SQLite3::BusyException: database is locked: commit transaction
66
66
  def fix_db
67
- # if ActiveRecord::Base.connection.adapter_name.downcase.include?('sqlite')
68
- # ActiveRecord::Base.connection.execute("END;")
69
- # ActiveRecord::Base.connection.execute("BEGIN TRANSACTION;")
70
- # end
67
+ if ActiveRecord::Base.connection.adapter_name.downcase.include?('sqlite')
68
+ ActiveRecord::Base.connection.execute("END;") rescue SQLite3::SQLException
69
+ # ActiveRecord::Base.connection.execute("BEGIN TRANSACTION;")
70
+ end
71
71
  end
72
72
 
73
73
  def pages_test
@@ -106,7 +106,7 @@ end
106
106
 
107
107
  def confirm_dialog
108
108
  if page.driver.class.to_s == 'Capybara::Selenium::Driver'
109
- page.driver.browser.switch_to.alert.accept
109
+ page.driver.browser.switch_to.alert.accept rescue Selenium::WebDriver::Error::NoAlertPresentError
110
110
  elsif page.driver.class.to_s == 'Capybara::Webkit::Driver'
111
111
  sleep 1 # prevent test from failing by waiting for popup
112
112
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: camaleon_cms
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.4.5.13
4
+ version: 2.4.5.14
5
5
  platform: ruby
6
6
  authors:
7
7
  - Owen Peredo Diaz
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-03-11 00:00:00.000000000 Z
11
+ date: 2019-03-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bcrypt