Sha256: 44fc0d4b2441e7ebb74c32e342312f2b0f1fc8d7ac8ed1b312fd3bf1bf16f06b

Contents?: true

Size: 1.09 KB

Versions: 1

Compression:

Stored size: 1.09 KB

Contents

require 'contractual'
require 'xmlsimple'

require 'coronet/message_format/base'
require 'coronet/message_format/xml_message_format'
require 'coronet/message_format/yaml_message_format'

module Coronet
  module MessageFormat
    describe Base, "should describe structured message formats" do
    
      before :each do
        @yml, @xml = YamlMessageFormat.new, XmlMessageFormat.new
        @yml_data = "---\nhello: world\n"
        @xml_data = "<hello>world</hello>"
      end
    
      it "should handle yml" do
        @yml.unpack(@yml_data).should == { 'hello' => 'world' }
        @yml.pack(@yml.unpack(@yml_data)).should == @yml_data
      end
    
      it "should handle xml" do
        @xml.unpack(@xml_data).should == { 'hello' => 'world' }
        @xml.pack(@xml.unpack(@xml_data), nil).should == @xml_data
      end

      it "should handle transforming yml to xml (and vice versa)" do
        @xml.unpack(@xml_data).should == @yml.unpack(@yml_data)
        @xml.pack(@yml.unpack(@yml_data), nil).should == @xml_data
        @yml.pack(@xml.unpack(@xml_data)).should == @yml_data
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
coronet-0.0.2 spec/coronet/message_format/base.spec