spec/array_spec.rb in bindata-0.5.0 vs spec/array_spec.rb in bindata-0.5.1
- old
+ new
@@ -26,49 +26,49 @@
type = [:int16le, {:initial_value => lambda { index + 1 }}]
@data = BinData::Array.new(:type => type, :initial_length => 5)
end
specify "should return a correct snapshot" do
- @data.snapshot.should == [1, 2, 3, 4, 5]
+ @data.snapshot.should eql([1, 2, 3, 4, 5])
end
specify "should have correct num elements" do
- @data.length.should == 5
- @data.size.should == 5
+ @data.length.should eql(5)
+ @data.size.should eql(5)
end
specify "should have correct num_bytes" do
- @data.num_bytes.should == 10
+ @data.num_bytes.should eql(10)
end
specify "should have correct num_bytes for individual elements" do
- @data.num_bytes(0).should == 2
+ @data.num_bytes(0).should eql(2)
end
specify "should have no field_names" do
@data.field_names.should be_empty
end
specify "should be able to directly access elements" do
@data[1] = 8
- @data[1].should == 8
+ @data[1].should eql(8)
end
specify "should be able to use methods from Enumerable" do
- @data.select { |x| (x % 2) == 0 }.should == [2, 4]
+ @data.select { |x| (x % 2) == 0 }.should eql([2, 4])
end
specify "should clear" do
@data[1] = 8
@data.clear
- @data.collect.should == [1, 2, 3, 4, 5]
+ @data.collect.should eql([1, 2, 3, 4, 5])
end
specify "should clear a single element" do
@data[1] = 8
@data.clear(1)
- @data[1].should == 2
+ @data[1].should eql(2)
end
specify "should be clear upon creation" do
@data.clear?.should be_true
end
@@ -90,14 +90,14 @@
@data[1] = 8
@data.write(io)
@data.clear
io.rewind
- @data[1].should == 2
+ @data[1].should eql(2)
@data.read(io)
- @data[1].should == 8
+ @data[1].should eql(8)
end
end
context "An Array containing structs" do
setup do
@@ -106,16 +106,16 @@
[:int8, :b]]}]
@data = BinData::Array.new(:type => type, :initial_length => 5)
end
specify "should access elements, not values" do
- @data[3].a.should == 3
+ @data[3].a.should eql(3)
end
specify "should not be able to modify elements" do
lambda { @data[1] = 3 }.should raise_error(NoMethodError)
end
specify "should interate over each element" do
- @data.collect { |s| s.a }.should == [0, 1, 2, 3, 4]
+ @data.collect { |s| s.a }.should eql([0, 1, 2, 3, 4])
end
end