matthewtodd-has_digest 0.1.1 → 0.1.2

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/lib/has_digest.rb CHANGED
@@ -2,7 +2,7 @@ require 'digest/sha1'
2
2
 
3
3
  module HasDigest
4
4
  def self.included(base) # :nodoc:
5
- base.before_save :generate_has_digest_attributes
5
+ base.before_save :generate_has_digest_attributes, :unless => lambda { |record| record.class.has_digest_attributes.empty? }
6
6
  base.extend(ClassMethods)
7
7
  end
8
8
 
@@ -97,6 +97,18 @@ class HasDigestTest < Test::Unit::TestCase
97
97
  end
98
98
  end
99
99
 
100
+ context 'Model with a magic salt column' do
101
+ setup { @klass = model_with_attributes(:salt) }
102
+
103
+ context 'saved instance' do
104
+ setup { @instance = @klass.create }
105
+
106
+ should 'not have digested salt attribute' do
107
+ assert_nil @instance.salt
108
+ end
109
+ end
110
+ end
111
+
100
112
  context 'Model with a magic salt column and an attribute-based digest' do
101
113
  setup do
102
114
  @klass = model_with_attributes(:salt, :encrypted_password) do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: matthewtodd-has_digest
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matthew Todd
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2008-11-11 00:00:00 -08:00
12
+ date: 2008-12-02 00:00:00 -08:00
13
13
  default_executable:
14
14
  dependencies: []
15
15
 
@@ -37,7 +37,7 @@ rdoc_options:
37
37
  - --main
38
38
  - README.rdoc
39
39
  - --title
40
- - has_digest-0.1.1
40
+ - has_digest-0.1.2
41
41
  - --inline-source
42
42
  - --line-numbers
43
43
  require_paths: