idy 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +10 -0
- data/lib/idy/extension.rb +2 -6
- data/lib/idy/version.rb +1 -1
- data/spec/lib/idy/extension/options_spec.rb +0 -6
- metadata +1 -3
- data/spec/lib/idy/extension/idy_options_spec.rb +0 -29
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6349ce9069910d1380b20fc75f10ac110a18abb1
|
4
|
+
data.tar.gz: af38de63a88d7dd6ba36b8c872f9e195eea5f0fc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 44256a6ec3fd85dfbac624cbd9c25ab87963e737db3fc503a7dfd1b446fb6aa035c7cad59c64954159de273d6ad154e9cadfa5902779b7b0e3cb2951efb6cbd9
|
7
|
+
data.tar.gz: f774c785912c30529bea0961ed8e347f8002da7f63c3547cce19d5c1ff651c2757ac33e3a3cad9249d74c5587198fc9ae7d6a3529a1d15bb547765f7778b83d1
|
data/CHANGELOG.md
CHANGED
data/lib/idy/extension.rb
CHANGED
@@ -9,10 +9,6 @@ module Idy
|
|
9
9
|
self.class.idy_encode id
|
10
10
|
end
|
11
11
|
|
12
|
-
def idy_options
|
13
|
-
self.class.idy_options
|
14
|
-
end
|
15
|
-
|
16
12
|
def salt
|
17
13
|
self.class.salt
|
18
14
|
end
|
@@ -40,7 +36,7 @@ module Idy
|
|
40
36
|
end
|
41
37
|
|
42
38
|
def idy(options = {})
|
43
|
-
@
|
39
|
+
@idy_options = options.reverse_merge(salt: idy_default_salt)
|
44
40
|
|
45
41
|
define_singleton_method(:idy?) { true }
|
46
42
|
end
|
@@ -66,7 +62,7 @@ module Idy
|
|
66
62
|
end
|
67
63
|
|
68
64
|
def idy_options
|
69
|
-
@
|
65
|
+
@idy_options || { salt: idy_default_salt }
|
70
66
|
end
|
71
67
|
|
72
68
|
def salt
|
data/lib/idy/version.rb
CHANGED
@@ -3,12 +3,6 @@
|
|
3
3
|
require 'rails_helper'
|
4
4
|
|
5
5
|
RSpec.describe '.idy_options' do
|
6
|
-
context 'when callback is not given' do
|
7
|
-
it 'returns a default options with a salt generated based on model name' do
|
8
|
-
expect(Clean.new.idy_options).to eq(salt: clean_default_salt)
|
9
|
-
end
|
10
|
-
end
|
11
|
-
|
12
6
|
context 'when options is not given' do
|
13
7
|
it 'returns a default options with a salt generated based on model name' do
|
14
8
|
expect(Article.idy_options).to eq(salt: article_default_salt)
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: idy
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Washington Botelho
|
@@ -159,7 +159,6 @@ files:
|
|
159
159
|
- spec/lib/idy/extension/idy_decode_spec.rb
|
160
160
|
- spec/lib/idy/extension/idy_default_salt_spec.rb
|
161
161
|
- spec/lib/idy/extension/idy_encode_spec.rb
|
162
|
-
- spec/lib/idy/extension/idy_options_spec.rb
|
163
162
|
- spec/lib/idy/extension/idy_spec.rb
|
164
163
|
- spec/lib/idy/extension/lock_spec.rb
|
165
164
|
- spec/lib/idy/extension/options_spec.rb
|
@@ -206,7 +205,6 @@ test_files:
|
|
206
205
|
- spec/lib/idy/extension/idy_decode_spec.rb
|
207
206
|
- spec/lib/idy/extension/idy_default_salt_spec.rb
|
208
207
|
- spec/lib/idy/extension/idy_encode_spec.rb
|
209
|
-
- spec/lib/idy/extension/idy_options_spec.rb
|
210
208
|
- spec/lib/idy/extension/idy_spec.rb
|
211
209
|
- spec/lib/idy/extension/lock_spec.rb
|
212
210
|
- spec/lib/idy/extension/options_spec.rb
|
@@ -1,29 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'rails_helper'
|
4
|
-
|
5
|
-
RSpec.describe ':idy_options' do
|
6
|
-
describe '.idy_options' do
|
7
|
-
context 'when has options' do
|
8
|
-
it 'returns the options' do
|
9
|
-
expect(Comment.new.idy_options).to eq(salt: 'salt')
|
10
|
-
end
|
11
|
-
end
|
12
|
-
|
13
|
-
context 'when has no options' do
|
14
|
-
it 'returns an default one' do
|
15
|
-
expect(Clean.new.idy_options).to eq(salt: clean_default_salt)
|
16
|
-
end
|
17
|
-
end
|
18
|
-
end
|
19
|
-
|
20
|
-
describe '#idy_options' do
|
21
|
-
before do
|
22
|
-
allow(Clean).to receive(:idy_options) { :idy_options }
|
23
|
-
end
|
24
|
-
|
25
|
-
it 'delegates to class method' do
|
26
|
-
expect(Clean.new.idy_options).to eq :idy_options
|
27
|
-
end
|
28
|
-
end
|
29
|
-
end
|