Sha256: 751ab18f584343d9502434290b7aa91ba38938b807243a45da1a0fd645aedaac

Contents?: true

Size: 763 Bytes

Versions: 4

Compression:

Stored size: 763 Bytes

Contents

require "spec_helper"

#  IMPORTANT:
#  The following test is valid ONLY if it is run first or by itself.
#  If a HashModel object has been instantiated before this test the
#  test will not properly verify that the dynamic methods are recreated.

describe HashModel do

  let(:hm_file) {File.expand_path((File.dirname(__FILE__) + '/hashmodel.dat'))}
  let(:hm) {Marshal.load(File.open(hm_file, "r"))}

  context "after deserializing an instance" do
    
    it "remaps dynamic methods if one of them is called" do
      lambda{hm.length}.should_not raise_error
    end
    
  end
  
  context "when a legitimatly non-exisitant method is called" do
    it "should raise an error" do
      lambda{hm.ice_cream}.should raise_error(NoMethodError)
    end
  end

end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
hashmodel-0.4.0 spec/hash_model/_marshelling_spec.rb
hashmodel-0.4.0.rc1 spec/hash_model/_marshelling_spec.rb
hashmodel-0.4.0.beta2 spec/hash_model/_marshelling_spec.rb
hashmodel-0.4.0.beta1 spec/hash_model/_marshelling_spec.rb