spec/base_primitive_spec.rb in bindata-0.10.0 vs spec/base_primitive_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/base_primitive' require 'bindata/io' class ExampleSingle # reopen example to make @in_read public for testing @@ -121,9 +121,18 @@ end it "should be equal to raw values" do @data.should == 5 5.should == @data + end + + it "should work as hash keys" do + hash = {5 => 17} + + obj = ExampleSingle.new + obj.value = 5 + + hash[obj].should == 17 end end describe BinData::BasePrimitive, "after initialisation" do before(:each) do