obfuscate 0.0.5 → 0.0.6

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore CHANGED
@@ -11,10 +11,12 @@ spec/reports
11
11
  test/tmp
12
12
  test/version_tmp
13
13
  tmp
14
+ .rbenv-gemsets
14
15
 
15
- #idea files
16
+ #ide
16
17
  *.iml
17
18
  .idea
19
+ .redcar
18
20
 
19
21
  # YARD artifacts
20
22
  .yardoc
data/CHANGELOG.md ADDED
@@ -0,0 +1,5 @@
1
+ ## Obfucate Changelog
2
+
3
+ ### 0.0.6 (May 11, 2013)
4
+
5
+ * Implement a new method called find_obfuscated [thanks minostro]
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- obfuscate (0.0.4)
4
+ obfuscate (0.0.6)
5
5
  otherinbox-crypt19 (~> 1.2.1)
6
6
 
7
7
  GEM
@@ -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 )
@@ -14,5 +14,5 @@
14
14
  # the License.
15
15
 
16
16
  module Obfuscate
17
- VERSION = "0.0.5"
17
+ VERSION = "0.0.6"
18
18
  end
@@ -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.5
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-02-20 00:00:00.000000000 Z
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.25
176
+ rubygems_version: 1.8.23
176
177
  signing_key:
177
178
  specification_version: 3
178
179
  summary: Obfuscate