Permalink
Browse files

Fixed bug with encoding values with line brake characters.(Array() in…

… 1.8.x ruby has a bug?)
  • Loading branch information...
1 parent dc5bba7 commit 62c3e398d62dd12b5bd99dd919d47a6d02384208 @ayanko ayanko committed Jan 25, 2012
Showing with 8 additions and 1 deletion.
  1. +1 −1 lib/rack_session_access.rb
  2. +7 −0 spec/rack_session_access_spec.rb
@@ -10,7 +10,7 @@ class << self
# encode session hash to string
def encode(hash)
- Array(Marshal.dump(hash)).pack('m')
+ [Marshal.dump(hash)].pack('m')
end
# decode string to session hash
@@ -28,4 +28,11 @@
result = subject.decode(data)
result.should == source
end
+
+ it "should encode and decode values with line brake characters" do
+ source = { 'line' => "one\ntwo" }
+ data = subject.encode(source)
+ result = subject.decode(data)
+ result.should == source
+ end
end

0 comments on commit 62c3e39

Please sign in to comment.