test/decode_spec.rb in erlectricity-0.1.0 vs test/decode_spec.rb in erlectricity-0.2.0

- old
+ new

@@ -1,18 +1,9 @@ require File.dirname(__FILE__) + '/test_helper.rb' -context "The byte reader attached to decoder" do - specify "should not advance the stream when peeking unless there arent enough bytes available" do - @decoder = Erlectricity::Decoder.new(StringIO.new('abcdefghijklmnopqrstuvwxyz')) - 100.times{ @decoder.peek_1.should == 'a'[0] } - 100.times{ @decoder.peek_2.should == 'ab'.unpack("n").first } - end -end - context "When unpacking from a binary stream" do setup do - @decoder = Erlectricity::Decoder.new(nil) end specify "an erlang atom should decode to a ruby symbol" do get("haha").should == :haha end @@ -125,9 +116,8 @@ get("<< \"whatup\" >>").should == "whatup" end def get(str) bin = run_erl("term_to_binary(#{str})") - @decoder.in = StringIO.new(bin) - @decoder.read_any + Erlectricity::Decoder.read_any_from(bin) end end \ No newline at end of file