Sha256: 319e50434a4879a19e21a418b50910e6f223ca7d21b642f94897a45b8ead77a6

Contents?: true

Size: 1007 Bytes

Versions: 27

Compression:

Stored size: 1007 Bytes

Contents

require 'key_holder_test'

class User < ActiveRecord::Base
  keyholder
end

class AssociationKeyHolderTest < KeyHolderTest
  def setup
    @key_holder=User.create
  end
  
  def test_should_retain_session_key_on_reload
    key=EzCrypto::Key.generate
    key_holder.set_session_key key
    assert_not_nil key_holder.session_key
    assert_equal key.raw,key_holder.session_key.raw
    
    reloaded=User.find key_holder.id
    assert_not_nil reloaded.session_key
    assert_equal key.raw,reloaded.session_key.raw    
  end
  
  def test_should_retain_session_key_on_reload_for_record_with_key_set_before_create
    key=EzCrypto::Key.generate
    key_holder=User.new
    assert_nil key_holder.session_key
    
    key_holder.set_session_key key
    assert_not_nil key_holder.session_key
    
    assert_equal key.raw,key_holder.session_key.raw
    key_holder.save
    
    reloaded=User.find key_holder.id
    assert_not_nil reloaded.session_key
    assert_equal key.raw,reloaded.session_key.raw    
  end
end

Version data entries

27 entries across 27 versions & 5 rubygems

Version Path
rhodes-7.6.0 lib/extensions/ezcrypto/ext/test/association_key_holder_test.rb
rhodes-7.5.1 lib/extensions/ezcrypto/ext/test/association_key_holder_test.rb
rhodes-7.4.1 lib/extensions/ezcrypto/ext/test/association_key_holder_test.rb
rhodes-7.1.17 lib/extensions/ezcrypto/ext/test/association_key_holder_test.rb
rhodes-6.2.0 lib/extensions/ezcrypto/ext/test/association_key_holder_test.rb
ezcrypto2-0.0.2 test/association_key_holder_test.rb
rhodes-6.0.11 lib/extensions/ezcrypto/ext/test/association_key_holder_test.rb
rhodes-5.5.18 lib/extensions/ezcrypto/ext/test/association_key_holder_test.rb
rhodes-5.5.17 lib/extensions/ezcrypto/ext/test/association_key_holder_test.rb
rhodes-5.5.15 lib/extensions/ezcrypto/ext/test/association_key_holder_test.rb
rhodes-5.5.0.22 lib/extensions/ezcrypto/ext/test/association_key_holder_test.rb
rhodes-5.5.2 lib/extensions/ezcrypto/ext/test/association_key_holder_test.rb
rhodes-5.5.0.7 lib/extensions/ezcrypto/ext/test/association_key_holder_test.rb
rhodes-5.5.0.3 lib/extensions/ezcrypto/ext/test/association_key_holder_test.rb
rhodes-5.5.0 lib/extensions/ezcrypto/ext/test/association_key_holder_test.rb
tauplatform-1.0.3 lib/extensions/ezcrypto/ext/test/association_key_holder_test.rb
tauplatform-1.0.2 lib/extensions/ezcrypto/ext/test/association_key_holder_test.rb
tauplatform-1.0.1 lib/extensions/ezcrypto/ext/test/association_key_holder_test.rb
jamescook-ezcrypto-0.7.4 test/association_key_holder_test.rb
rhodes-3.5.1.12 lib/extensions/ezcrypto/ext/test/association_key_holder_test.rb