File tree Expand file tree Collapse file tree 3 files changed +20
-1
lines changed Expand file tree Collapse file tree 3 files changed +20
-1
lines changed Original file line number Diff line number Diff line change 34
34
configs . each do |config |
35
35
namespace :test do
36
36
task config do
37
+ if config . to_s . start_with? ( "encrypted" ) && ENV [ "TARGET_DB" ] == "postgres"
38
+ puts "Skipping encrypted tests on PostgreSQL as binary encrypted columns are not supported by Rails yet"
39
+ return
40
+ end
41
+
37
42
if config == :default
38
43
sh ( "bin/rails test" )
39
44
else
Original file line number Diff line number Diff line change @@ -35,5 +35,13 @@ class Engine < ::Rails::Engine
35
35
config . after_initialize do
36
36
Rails . cache . setup! if Rails . cache . is_a? ( Store )
37
37
end
38
+
39
+ config . after_initialize do
40
+ if SolidCache . configuration . encrypt? && SolidCache ::Record . connection . adapter_name == "PostgreSQL"
41
+ raise \
42
+ "Cannot enable encryption for Solid Cache: Active Record Encryption does not currently support " \
43
+ "encrypting binary columns on PostgreSQL"
44
+ end
45
+ end
38
46
end
39
47
end
Original file line number Diff line number Diff line change @@ -40,7 +40,13 @@ class SolidCache::EncryptionTest < ActiveSupport::TestCase
40
40
41
41
private
42
42
def raw_first_value
43
- SolidCache ::Entry . connection . select_all ( "select * from solid_cache_entries order by id desc limit 1" ) . first [ "value" ]
43
+ raw = SolidCache ::Entry . connection . select_all ( "select * from solid_cache_entries order by id desc limit 1" ) . first [ "value" ]
44
+
45
+ if ActiveRecord ::Base . connection . adapter_name == "PostgreSQL"
46
+ ActiveRecord ::Base . connection . unescape_bytea ( raw )
47
+ else
48
+ raw
49
+ end
44
50
end
45
51
46
52
def first_value
You can’t perform that action at this time.
0 commit comments