Sha256: 5c45cb396ccdf350967a439111fb904a513d1a4373f46c092b93faefecb36db4

Contents?: true

Size: 970 Bytes

Versions: 1

Compression:

Stored size: 970 Bytes

Contents

require 'spec_helper.rb'

describe 'RFlow::Message::Data::IRC::Message Avro Schema' do
  before(:each) do
    @schema_string = RFlow::Configuration.available_data_types['RFlow::Message::Data::IRC::Message']['avro']
  end

  it "should encode and decode an object" do
    irc_message = {
      'timestamp' => Time.now.xmlschema,
      #      'prefix'     => nil,
      'command'    => 'PRIVMSG',
      'parameters' => ['yo yo yo'],
    }

    expect {encode_avro(@schema_string, irc_message)}.to_not raise_error
    avro_encoded_irc_message = encode_avro(@schema_string, irc_message)

    expect {decode_avro(@schema_string, avro_encoded_irc_message)}.to_not raise_error
    decoded_irc_message = decode_avro(@schema_string, avro_encoded_irc_message)

    decoded_irc_message['prefix'].should == irc_message['prefix']
    decoded_irc_message['command'].should == irc_message['command']
    decoded_irc_message['parameters'].should == irc_message['parameters']

  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rflow-components-irc-0.0.2 spec/schema_spec.rb