idy 1.0.0 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: def5f180e468e7b690506b0c44629f0f8ee2f1f8c43faef0c3da2dd4d84bca7c
4
- data.tar.gz: a75a3403bb5564350d46db9655f9f4acec21d3f7079820a60442a9e0cfc8ec10
3
+ metadata.gz: 48f9d830da49d857d4e7a933837f63a82be37a0bf8b79bb254ce9894e929c778
4
+ data.tar.gz: 7d564312480c2cd78a406669d90eb3e1b9a2f7a6a9d0675b131851c1aff1cfe0
5
5
  SHA512:
6
- metadata.gz: 86b8b4eaddbc6acc12c7c5a9ee72c31d884a2835d66a0bbff5a1c90ab0a473ebf50f42a5fec0802c9bcd675f19a3ef028ec68ba0938554e3dcdf945360f9bc66
7
- data.tar.gz: 539a92ad5de1baf061e736250e12978bc4c1dc2f24f0aa36c1b0cdea61440eec75b75e2958f1b49b6600df277337e9b6749c75fb27e089bd1a1f5842437ae96f
6
+ metadata.gz: f20232384684b4aed106783643f6561ce92bc657430f24f15a34f8f0c38fe6ab7b706cbe5238bfa6e85636494470c0d78ab7c0e8635809eaaaab80508997d10b
7
+ data.tar.gz: 96ed2ff410876d03c33b74c6337df37e0a454d4a1602581384ce3d13ef0cb7a6ffc71ad4254f9498353e25c513bef612a5017fcf20905cce64fcf48f48cb7eb3
@@ -1,3 +1,10 @@
1
+ ## v1.1.0
2
+
3
+ - Updates
4
+ - Does not restrict Rails version;
5
+ - Does not restrict Hashids version;
6
+ - Bump Ruby version to 2.6.4;
7
+
1
8
  ## v1.0.0
2
9
 
3
10
  - News
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Idy
4
- VERSION = '1.0.0'
4
+ VERSION = '1.1.0'
5
5
  end
@@ -5,11 +5,11 @@ require 'rails_helper'
5
5
  RSpec.describe Article, '#findy!' do
6
6
  context 'when a hash is given' do
7
7
  context 'when record is found' do
8
- let!(:record) { Article.create id: 1 }
8
+ let!(:record) { described_class.create id: 1 }
9
9
  let!(:hash) { 'My' }
10
10
 
11
11
  it 'finds the record' do
12
- expect(Article.findy!(hash)).to eq record
12
+ expect(described_class.findy!(hash)).to eq record
13
13
  end
14
14
  end
15
15
 
@@ -19,7 +19,7 @@ RSpec.describe Article, '#findy!' do
19
19
  it 'raises' do
20
20
  message = %(Couldn't find User with 'idy'="My")
21
21
 
22
- expect { Article.findy!(hash) }.to raise_error ActiveRecord::RecordNotFound, message
22
+ expect { described_class.findy!(hash) }.to raise_error ActiveRecord::RecordNotFound, message
23
23
  end
24
24
  end
25
25
  end
@@ -5,11 +5,11 @@ require 'rails_helper'
5
5
  RSpec.describe Article, '#findy' do
6
6
  context 'when a hash is given' do
7
7
  context 'when record is found' do
8
- let!(:record) { Article.create id: 1 }
8
+ let!(:record) { described_class.create id: 1 }
9
9
  let!(:hash) { 'My' }
10
10
 
11
11
  it 'finds the record' do
12
- expect(Article.findy(hash)).to eq record
12
+ expect(described_class.findy(hash)).to eq record
13
13
  end
14
14
  end
15
15
 
@@ -17,7 +17,7 @@ RSpec.describe Article, '#findy' do
17
17
  let!(:hash) { 'My' }
18
18
 
19
19
  it 'returns nil' do
20
- expect(Article.findy(hash)).to be_nil
20
+ expect(described_class.findy(hash)).to be_nil
21
21
  end
22
22
  end
23
23
  end
@@ -5,7 +5,7 @@ require 'rails_helper'
5
5
  RSpec.describe Article, '#idy_decode' do
6
6
  context 'with no given salt' do
7
7
  it 'undos the obfuscation of id with default class salt' do
8
- expect(Article.idy_decode('My')).to eq 1
8
+ expect(described_class.idy_decode('My')).to eq 1
9
9
  end
10
10
  end
11
11
 
@@ -13,7 +13,7 @@ RSpec.describe Article, '#idy_decode' do
13
13
  let!(:salt) { '' }
14
14
 
15
15
  it 'undos the obfuscation of id with given salt' do
16
- expect(Article.idy_decode('jR', salt: salt)).to eq 1
16
+ expect(described_class.idy_decode('jR', salt: salt)).to eq 1
17
17
  end
18
18
  end
19
19
 
@@ -22,7 +22,7 @@ RSpec.describe Article, '#idy_decode' do
22
22
  let!(:salt) { 'salt' }
23
23
 
24
24
  it 'undos the obfuscation of id with given salt' do
25
- expect(Article.idy_decode('XG', salt: salt)).to eq 1
25
+ expect(described_class.idy_decode('XG', salt: salt)).to eq 1
26
26
  end
27
27
  end
28
28
 
@@ -30,7 +30,7 @@ RSpec.describe Article, '#idy_decode' do
30
30
  let!(:salt) { 1 }
31
31
 
32
32
  it 'undos the obfuscation of id with given salt as string' do
33
- expect(Article.idy_decode('kL', salt: 1)).to eq 1
33
+ expect(described_class.idy_decode('kL', salt: 1)).to eq 1
34
34
  end
35
35
  end
36
36
  end
@@ -5,7 +5,7 @@ require 'rails_helper'
5
5
  RSpec.describe Abcdefghijklm, '#idy_default_salt' do
6
6
  context 'when class name has a big length' do
7
7
  it 'is bases on the first 10 class letter position index on alphabet' do
8
- expect(Abcdefghijklm.idy_default_salt).to eq '12345678910'
8
+ expect(described_class.idy_default_salt).to eq '12345678910'
9
9
  end
10
10
  end
11
11
  end
@@ -4,7 +4,7 @@ require 'rails_helper'
4
4
 
5
5
  RSpec.describe Article, '#idy_encode' do
6
6
  context 'with no given salt' do
7
- let!(:model) { Article.new id: 1 }
7
+ let!(:model) { described_class.new id: 1 }
8
8
 
9
9
  it 'obfuscates the id with default class salt' do
10
10
  expect(model.class.idy_encode(model.id)).to eq 'My'
@@ -12,7 +12,7 @@ RSpec.describe Article, '#idy_encode' do
12
12
  end
13
13
 
14
14
  context 'with empty salt' do
15
- let!(:model) { Article.new id: 1 }
15
+ let!(:model) { described_class.new id: 1 }
16
16
  let!(:salt) { '' }
17
17
 
18
18
  it 'obfuscates the id with empty salt' do
@@ -21,7 +21,7 @@ RSpec.describe Article, '#idy_encode' do
21
21
  end
22
22
 
23
23
  context 'with salt' do
24
- let!(:model) { Article.new id: 1 }
24
+ let!(:model) { described_class.new id: 1 }
25
25
 
26
26
  context 'when is string' do
27
27
  let!(:salt) { 'salt' }
@@ -41,7 +41,7 @@ RSpec.describe Article, '#idy_encode' do
41
41
  end
42
42
 
43
43
  context 'with nil id' do
44
- let!(:model) { Article.new }
44
+ let!(:model) { described_class.new }
45
45
 
46
46
  it 'returns nil' do
47
47
  expect(model.class.idy_encode(model.id)).to be_nil
@@ -3,7 +3,7 @@
3
3
  require 'rails_helper'
4
4
 
5
5
  RSpec.describe Article, '.idy' do
6
- subject { Article.new id: 1 }
6
+ subject { described_class.new id: 1 }
7
7
 
8
8
  it 'returns the encoded id' do
9
9
  expect(subject.idy).to eq 'My'
@@ -5,7 +5,7 @@ require 'rails_helper'
5
5
  RSpec.describe Article, '.idy_options' do
6
6
  context 'when options is not given' do
7
7
  it 'returns a default options with a salt generated based on model name' do
8
- expect(Article.idy_options).to eq(salt: article_default_salt)
8
+ expect(described_class.idy_options).to eq(salt: article_default_salt)
9
9
  end
10
10
  end
11
11
 
@@ -4,18 +4,18 @@ require 'rails_helper'
4
4
 
5
5
  RSpec.describe Clean, ':salt' do
6
6
  describe '#salt' do
7
- before { allow(Clean).to receive(:idy_options).and_return(salt: :salty) }
7
+ before { allow(described_class).to receive(:idy_options).and_return(salt: :salty) }
8
8
 
9
9
  it 'fetchs the salt options' do
10
- expect(Clean.salt).to eq(:salty)
10
+ expect(described_class.salt).to eq(:salty)
11
11
  end
12
12
  end
13
13
 
14
14
  describe '.salt' do
15
- before { allow(Clean).to receive(:salt).and_return :salt }
15
+ before { allow(described_class).to receive(:salt).and_return :salt }
16
16
 
17
17
  it 'delegates to class method' do
18
- expect(Clean.new.salt).to eq :salt
18
+ expect(described_class.new.salt).to eq :salt
19
19
  end
20
20
  end
21
21
  end
@@ -4,7 +4,7 @@ require 'rails_helper'
4
4
 
5
5
  RSpec.describe Clean, '.to_param' do
6
6
  context 'when object does not acts as idy' do
7
- subject { Clean.new id: 1 }
7
+ subject { described_class.new id: 1 }
8
8
 
9
9
  it 'behaves as default' do
10
10
  expect(subject.to_param).to eq '1'
metadata CHANGED
@@ -1,49 +1,43 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: idy
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Washington Botelho
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-12-27 00:00:00.000000000 Z
11
+ date: 2019-10-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: hashids
14
+ name: activerecord
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: '1.0'
19
+ version: '0'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - "~>"
24
+ - - ">="
25
25
  - !ruby/object:Gem::Version
26
- version: '1.0'
26
+ version: '0'
27
27
  - !ruby/object:Gem::Dependency
28
- name: rails
28
+ name: hashids
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - ">="
32
32
  - !ruby/object:Gem::Version
33
- version: '5'
34
- - - "<"
35
- - !ruby/object:Gem::Version
36
- version: '6'
33
+ version: '0'
37
34
  type: :runtime
38
35
  prerelease: false
39
36
  version_requirements: !ruby/object:Gem::Requirement
40
37
  requirements:
41
38
  - - ">="
42
39
  - !ruby/object:Gem::Version
43
- version: '5'
44
- - - "<"
45
- - !ruby/object:Gem::Version
46
- version: '6'
40
+ version: '0'
47
41
  - !ruby/object:Gem::Dependency
48
42
  name: database_cleaner
49
43
  requirement: !ruby/object:Gem::Requirement
@@ -87,7 +81,7 @@ dependencies:
87
81
  - !ruby/object:Gem::Version
88
82
  version: '0'
89
83
  - !ruby/object:Gem::Dependency
90
- name: rubocop
84
+ name: rubocop-performance
91
85
  requirement: !ruby/object:Gem::Requirement
92
86
  requirements:
93
87
  - - ">="
@@ -179,8 +173,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
179
173
  - !ruby/object:Gem::Version
180
174
  version: '0'
181
175
  requirements: []
182
- rubyforge_project:
183
- rubygems_version: 2.7.3
176
+ rubygems_version: 3.0.6
184
177
  signing_key:
185
178
  specification_version: 4
186
179
  summary: An ID obfuscator for ActiveRecord.