obfuscate 0.0.5 → 0.0.6
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.
- data/.gitignore +3 -1
- data/CHANGELOG.md +5 -0
- data/Gemfile.lock +1 -1
- data/lib/obfuscate/obfuscatable.rb +7 -0
- data/lib/obfuscate/version.rb +1 -1
- data/spec/lib/obfuscate/ofuscatable_spec.rb +12 -0
- metadata +4 -3
data/.gitignore
CHANGED
data/CHANGELOG.md
ADDED
data/Gemfile.lock
CHANGED
@@ -55,6 +55,13 @@ module Obfuscate
|
|
55
55
|
find_by_id( clarify_id( text ) )
|
56
56
|
end
|
57
57
|
|
58
|
+
# Find by obfuscated_id
|
59
|
+
# @raises ActiveRecord::RecordNotFound
|
60
|
+
# @return [Object]
|
61
|
+
def find_obfuscated( text )
|
62
|
+
find( clarify_id( text ) )
|
63
|
+
end
|
64
|
+
|
58
65
|
# Clarifies obfuscated Model id
|
59
66
|
# @return [String]
|
60
67
|
def clarify_id( text )
|
data/lib/obfuscate/version.rb
CHANGED
@@ -22,6 +22,10 @@ describe Obfuscate::Obfuscatable do
|
|
22
22
|
ActiveRecord::Base.method_defined?( :find_by_obfuscated_id ).should be_false
|
23
23
|
end
|
24
24
|
|
25
|
+
it "should give a hoot and not pollute" do
|
26
|
+
ActiveRecord::Base.method_defined?( :find_obfuscated ).should be_false
|
27
|
+
end
|
28
|
+
|
25
29
|
it "should have config" do
|
26
30
|
Message.obfuscatable_config.salt.should eql "message salt"
|
27
31
|
end
|
@@ -61,6 +65,14 @@ describe Obfuscate::Obfuscatable do
|
|
61
65
|
it "should find_by_obfuscated_id" do
|
62
66
|
Message.find_by_obfuscated_id( model.obfuscated_id ).should eql model
|
63
67
|
end
|
68
|
+
|
69
|
+
it "should find_obfuscated" do
|
70
|
+
Message.find_obfuscated(model.obfuscated_id).should eql model
|
71
|
+
end
|
72
|
+
|
73
|
+
it "raises ActiveRecord::RecordNotFound retreiving a not existing model" do
|
74
|
+
expect { Message.find_obfuscated('NOT_EXIST') }.to raise_error(ActiveRecord::RecordNotFound)
|
75
|
+
end
|
64
76
|
end
|
65
77
|
end
|
66
78
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: obfuscate
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.6
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-
|
12
|
+
date: 2013-05-11 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: otherinbox-crypt19
|
@@ -132,6 +132,7 @@ extra_rdoc_files: []
|
|
132
132
|
files:
|
133
133
|
- .gitignore
|
134
134
|
- .rspec
|
135
|
+
- CHANGELOG.md
|
135
136
|
- Gemfile
|
136
137
|
- Gemfile.lock
|
137
138
|
- Guardfile
|
@@ -172,7 +173,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
172
173
|
version: '0'
|
173
174
|
requirements: []
|
174
175
|
rubyforge_project:
|
175
|
-
rubygems_version: 1.8.
|
176
|
+
rubygems_version: 1.8.23
|
176
177
|
signing_key:
|
177
178
|
specification_version: 3
|
178
179
|
summary: Obfuscate
|