Sha256: fb53a36bee3958e266fa31a2ced6bc7c6e4d764049d48910eb1efa118451e92d

Contents?: true

Size: 974 Bytes

Versions: 7

Compression:

Stored size: 974 Bytes

Contents

require File.dirname(__FILE__) + "/spec_helper"

instance_eval do
  class YARD::Serializers::YardocSerializer
    public :dump
    public :internal_dump
  end
end

describe YARD::Serializers::YardocSerializer do
  describe '#dump' do
    before do
      @serializer = YARD::Serializers::YardocSerializer.new('.yardoc')

      Registry.clear
      @foo = CodeObjects::ClassObject.new(:root, :Foo)
      @bar = CodeObjects::MethodObject.new(@foo, :bar)
    end

    it "should maintain object equality when loading a dumped object" do
      newfoo = @serializer.internal_dump(@foo)
      newfoo.should equal(@foo)
      newfoo.should == @foo
      @foo.should equal(newfoo)
      @foo.should == newfoo
      newfoo.hash.should == @foo.hash
    end
    
    it "should maintain hash key equality when loading a dumped object" do
      newfoo = @serializer.internal_dump(@foo)
      {@foo => 1}.should have_key(newfoo)
      {newfoo => 1}.should have_key(@foo)
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
yard-0.6.4 spec/serializers/yardoc_serializer_spec.rb
yard-0.6.3 spec/serializers/yardoc_serializer_spec.rb
yard-0.6.2 spec/serializers/yardoc_serializer_spec.rb
yard-0.6.1 spec/serializers/yardoc_serializer_spec.rb
yard-0.6.0 spec/serializers/yardoc_serializer_spec.rb
yard-0.5.8 spec/serializers/yardoc_serializer_spec.rb
yard-0.5.7 spec/serializers/yardoc_serializer_spec.rb