Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-01-29 18:08:59 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2020-01-29 18:08:59 +0300
commit23288f62da73fb0e30d8e7ce306665e8fda1b932 (patch)
tree2baf1339e4d7c7c35d6b8a52cfb90597a5d4cdf1 /spec/initializers
parent7cc6872401eb487ed20dbb9d455f8bb9c97d9e39 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/initializers')
-rw-r--r--spec/initializers/attr_encrypted_thread_safe_spec.rb28
1 files changed, 28 insertions, 0 deletions
diff --git a/spec/initializers/attr_encrypted_thread_safe_spec.rb b/spec/initializers/attr_encrypted_thread_safe_spec.rb
new file mode 100644
index 00000000000..096b8b196b4
--- /dev/null
+++ b/spec/initializers/attr_encrypted_thread_safe_spec.rb
@@ -0,0 +1,28 @@
+# frozen_string_literal: true
+
+require 'spec_helper'
+
+describe AttrEncrypted do
+ describe '#encrypted_attributes' do
+ subject do
+ Class.new(ActiveRecord::Base) do
+ self.table_name = 'projects'
+
+ attr_accessor :encrypted_foo
+ attr_accessor :encrypted_foo_iv
+
+ attr_encrypted :foo, key: 'This is a key that is 256 bits!!'
+ end
+ end
+
+ it 'does not share state with other instances' do
+ instance = subject.new
+ instance.foo = 'bar'
+
+ another_instance = subject.new
+
+ expect(instance.encrypted_attributes[:foo][:operation]).to eq(:encrypting)
+ expect(another_instance.encrypted_attributes[:foo][:operation]).to be_nil
+ end
+ end
+end