Sha256: 1ce64a8ff685141a36e9e690bf446eff82b36f001d07a5b5eeb13d29ada06d90

Contents?: true

Size: 1.18 KB

Versions: 1

Compression:

Stored size: 1.18 KB

Contents

require File.dirname(__FILE__) + '/test_helper'

class ProtopuffsTest < Test::Unit::TestCase

  context ".proto_load_path accessors" do
    setup { Protopuffs.proto_load_path = [] }

    should "have an accessor for an array of load paths for .proto files" do
      Protopuffs.proto_load_path << "proto_files" << "other_proto_files"
      assert_equal ["proto_files", "other_proto_files"], Protopuffs.proto_load_path
    end

    should "have a mutator for directly assigning the load paths" do
      Protopuffs.proto_load_path = ["my_proto_files"]
      assert_equal ["my_proto_files"], Protopuffs.proto_load_path
    end
  end

  should "have a ParseError class" do
    Protopuffs::ParseError
  end


  context ".load_message_classes when a descriptor is in the load path with a Person message" do
    setup { Protopuffs.proto_load_path = ["#{File.dirname(__FILE__)}/fixtures/proto"] }

    should "create a Person message class with correct accessors" do
      Protopuffs.load_message_classes
      p = Protopuffs::Message::Person.new
      p.name = "Chris"
      p.id = 42
      p.email = "chris@kampers.net"
      assert_equal ["Chris", 42, "chris@kampers.net"], [p.name, p.id, p.email]
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
chrisk-protopuffs-0.2.0 test/protopuffs_test.rb