Permalink
Browse files

to_json support

  • Loading branch information...
1 parent 0522bca commit a67db71a847b4462a801d4eea69548e2a72554bd @spikex committed Mar 18, 2011
Showing with 11 additions and 1 deletion.
  1. +1 −1 lib/strongbox.rb
  2. +4 −0 lib/strongbox/lock.rb
  3. +6 −0 test/strongbox_test.rb
View
@@ -5,7 +5,7 @@
module Strongbox
- VERSION = "0.4.5"
+ VERSION = "0.4.6"
RSA_PKCS1_PADDING = OpenSSL::PKey::RSA::PKCS1_PADDING
RSA_SSLV23_PADDING = OpenSSL::PKey::RSA::SSLV23_PADDING
@@ -100,6 +100,10 @@ def to_s
decrypt
end
+ def to_json(options = nil)
+ to_s
+ end
+
# Needed for validations
def blank?
@instance[@name].blank?
@@ -46,6 +46,12 @@ class StrongboxTest < Test::Unit::TestCase
end
end
+ should 'impliment to_json' do
+ assert_nothing_raised do
+ @dummy.secret.to_json
+ end
+ end
+
context 'updating unencrypted fields' do
setup do
@dummy.in_the_clear = 'I see you...'

0 comments on commit a67db71

Please sign in to comment.