spec/array_spec.rb in bindata-0.10.0 vs spec/array_spec.rb in bindata-0.11.0

- old
+ new

@@ -1,9 +1,9 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__)) + '/spec_common' -require File.expand_path(File.dirname(__FILE__)) + '/example' +require File.expand_path(File.join(File.dirname(__FILE__), "spec_common")) +require File.expand_path(File.join(File.dirname(__FILE__), "example")) require 'bindata/array' require 'bindata/int' describe BinData::Array, "when instantiating" do it "should ensure mandatory parameters are supplied" do @@ -133,11 +133,11 @@ it "should have correct num_bytes" do @data.num_bytes.should == 5 * ExampleSingle.new.num_bytes end it "should have correct num_bytes for individual elements" do - @data.num_bytes(0).should == ExampleSingle.new.num_bytes + @data[0].num_bytes.should == ExampleSingle.new.num_bytes end it "should be able to directly access elements" do @data[1] = 8 @data[1].should == 8 @@ -161,28 +161,28 @@ @data.collect.should == [1, 2, 3, 4, 5] end it "should clear a single element" do @data[1] = 8 - @data.clear(1) + @data[1].clear @data[1].should == 2 end it "should be clear upon creation" do @data.should be_clear end it "should be clear if all elements are clear" do @data[1] = 8 - @data.clear(1) + @data[1].clear @data.should be_clear end it "should test clear status of individual elements" do @data[1] = 8 - @data.clear?(0).should be_true - @data.clear?(1).should be_false + @data[0].should be_clear + @data[1].should_not be_clear end it "should symmetrically read and write" do @data[1] = 8 str = @data.to_binary_s @@ -264,24 +264,9 @@ @data.length.should == 5 end it "should not extend on [range]" do @data[9 .. 10].should be_nil - @data.length.should == 5 - end - - it "should not extend on clear" do - @data.clear(9) - @data.length.should == 5 - end - - it "should not extend on clear?" do - @data.clear?(9).should be_true - @data.length.should == 5 - end - - it "should not extend on num_bytes" do - @data.num_bytes(9).should == 0 @data.length.should == 5 end it "should raise error on bad input to []" do lambda { @data["a"] }.should raise_error(TypeError)