crypt_keeper 1.0.0.beta1 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e2c1586ce0dee73fb7513ac7c243426996af7947
4
- data.tar.gz: 8bc44c1580209d54e3614c8ecfcf9c30108f97f7
3
+ metadata.gz: 8256a26cb233344e7a8e71791aa528d931657317
4
+ data.tar.gz: 1ac4af01a5fee7957b611d967c6991bdab5a73d9
5
5
  SHA512:
6
- metadata.gz: 24ab4328521f6915fc2a516de9f84e1d25409e626c4299330093b112710a100a4c1978df64992e44a50b951f7f9f8eb7b30df6343c197449603f6f8e9df0507d
7
- data.tar.gz: 298e14e3bc7c4136bb6638c0f64c1a7a02d4163a443cafa6d7fffd778fa24f29659c98933f6b5e798e6881175f5ef592946194967af3c36c9796d3f6dcf3c778
6
+ metadata.gz: d9e9eecfd9eb95129d439624c4664890474fe9360b2a5097beb66f60b1e05f479192b9300530a703c0d38d6945c56c4def5c1a108b5d79099abba7fa5fd6dc35
7
+ data.tar.gz: c41b3baa8a72c0114702162fcdb857b145bdd668b7139cb391d600f48fa0888fa9a152b190815a00526b7a093ac636366df657b38b371e47893c7c85804ffb36
@@ -10,8 +10,9 @@ module CryptKeeper
10
10
  def ensure_valid_field!(field)
11
11
  if self.class.columns_hash["#{field}"].nil?
12
12
  raise ArgumentError, "Column :#{field} does not exist"
13
- elsif self.class.columns_hash["#{field}"].type != :text
14
- raise ArgumentError, "Column :#{field} must be of type 'text' to be used for encryption"
13
+ elsif !%i(text binary).include?(self.class.columns_hash["#{field}"].type)
14
+ raise ArgumentError, "Column :#{field} must be of type 'text' or 'binary' \
15
+ to be used for encryption"
15
16
  end
16
17
  end
17
18
 
@@ -1,3 +1,3 @@
1
1
  module CryptKeeper
2
- VERSION = "1.0.0.beta1"
2
+ VERSION = "1.0.0"
3
3
  end
@@ -24,8 +24,14 @@ describe CryptKeeper::Model do
24
24
  expect { subject.new.save }.to raise_error(ArgumentError, msg)
25
25
  end
26
26
 
27
- it "raises an exception for non text fields" do
28
- msg = "Column :name must be of type 'text' to be used for encryption"
27
+ it "allows binary as a valid type" do
28
+ subject.crypt_keeper :storage, encryptor: :fake_encryptor
29
+ allow(subject.columns_hash['storage']).to receive(:type).and_return(:binary)
30
+ expect(subject.new.save).to be_truthy
31
+ end
32
+
33
+ it "raises an exception for non text or binary fields" do
34
+ msg = "Column :name must be of type 'text' or 'binary' to be used for encryption"
29
35
  subject.crypt_keeper :name, encryptor: :fake_encryptor
30
36
  expect { subject.new.save }.to raise_error(ArgumentError, msg)
31
37
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: crypt_keeper
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0.beta1
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Justin Mazzi
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-04-19 00:00:00.000000000 Z
11
+ date: 2017-05-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord
@@ -277,12 +277,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
277
277
  version: '0'
278
278
  required_rubygems_version: !ruby/object:Gem::Requirement
279
279
  requirements:
280
- - - ">"
280
+ - - ">="
281
281
  - !ruby/object:Gem::Version
282
- version: 1.3.1
282
+ version: '0'
283
283
  requirements: []
284
284
  rubyforge_project:
285
- rubygems_version: 2.5.1
285
+ rubygems_version: 2.6.11
286
286
  signing_key:
287
287
  specification_version: 4
288
288
  summary: Transparent ActiveRecord encryption