Sha256: 40e8e92afc7e1f9f3ae021e38d3421470817dcfc8accc9c2342bf790ceb87ce2

Contents?: true

Size: 1.33 KB

Versions: 34

Compression:

Stored size: 1.33 KB

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
  before do
    @serializer = YARD::Serializers::YardocSerializer.new('.yardoc')

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

  describe '#dump' do
    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
  
  describe '#serialize' do
    it "should accept a hash of codeobjects (and write to root)" do
      data = {:root => Registry.root}
      marshaldata = Marshal.dump(data)
      filemock = mock(:file)
      filemock.should_receive(:write).with(marshaldata)
      File.should_receive(:open!).with('.yardoc/objects/root.dat', 'wb').and_yield(filemock)
      @serializer.serialize(data)
    end
  end
end

Version data entries

34 entries across 34 versions & 4 rubygems

Version Path
challah-0.6.2 vendor/bundle/gems/yard-0.7.5/spec/serializers/yardoc_serializer_spec.rb
challah-0.6.1 vendor/bundle/gems/yard-0.7.5/spec/serializers/yardoc_serializer_spec.rb
challah-0.6.0 vendor/bundle/gems/yard-0.7.5/spec/serializers/yardoc_serializer_spec.rb
challah-0.5.4 vendor/bundle/gems/yard-0.7.5/spec/serializers/yardoc_serializer_spec.rb
challah-0.5.3 vendor/bundle/gems/yard-0.7.5/spec/serializers/yardoc_serializer_spec.rb
challah-0.5.2 vendor/bundle/gems/yard-0.7.5/spec/serializers/yardoc_serializer_spec.rb
challah-0.5.1 vendor/bundle/gems/yard-0.7.5/spec/serializers/yardoc_serializer_spec.rb
challah-0.5.0 vendor/bundle/gems/yard-0.7.5/spec/serializers/yardoc_serializer_spec.rb
challah-0.4.1 vendor/bundle/gems/yard-0.7.5/spec/serializers/yardoc_serializer_spec.rb
challah-0.4.0 vendor/bundle/gems/yard-0.7.5/spec/serializers/yardoc_serializer_spec.rb
challah-0.3.5 vendor/bundle/gems/yard-0.7.5/spec/serializers/yardoc_serializer_spec.rb
challah-0.3.4 vendor/bundle/gems/yard-0.7.5/spec/serializers/yardoc_serializer_spec.rb
challah-0.3.3 vendor/bundle/gems/yard-0.7.5/spec/serializers/yardoc_serializer_spec.rb
challah-0.3.2 vendor/bundle/gems/yard-0.7.5/spec/serializers/yardoc_serializer_spec.rb
challah-0.3.1 vendor/bundle/gems/yard-0.7.5/spec/serializers/yardoc_serializer_spec.rb
challah-0.3.0 vendor/bundle/gems/yard-0.7.5/spec/serializers/yardoc_serializer_spec.rb
challah-0.2.1 vendor/bundle/gems/yard-0.7.5/spec/serializers/yardoc_serializer_spec.rb
challah-0.2.0 vendor/bundle/gems/yard-0.7.5/spec/serializers/yardoc_serializer_spec.rb
yard-0.7.5 spec/serializers/yardoc_serializer_spec.rb
nutshell-crm-0.0.6.alpha vendor/bundle/gems/yard-0.7.4/spec/serializers/yardoc_serializer_spec.rb