Sha256: 4e621c12dbc64f7a54a255538c88c9a9eaa52483623d913619b6be61b3c28238

Contents?: true

Size: 1.07 KB

Versions: 1

Compression:

Stored size: 1.07 KB

Contents

require File.expand_path(File.join(File.dirname(__FILE__), '..', 'lib', 'rflow'))

require 'fileutils'
require 'log4r'
require 'rspec/collection_matchers'

I18n.enforce_available_locales = true

RSpec.configure do |config|
  config.before(:all) do
    RFlow.logger = Log4r::Logger.new 'test'
    RFlow.logger.add Log4r::StdoutOutputter.new('test_stdout', :formatter => RFlow::Logger::LOG_PATTERN_FORMATTER)
    RFlow.logger.level = 5
    @base_temp_directory_path = File.join(File.dirname(__FILE__), 'tmp')
  end

  config.before(:each) do
    @entropy = Time.now.to_f.to_s
    @temp_directory_path = File.expand_path(File.join(@base_temp_directory_path, @entropy))
    FileUtils.mkdir_p @temp_directory_path
  end

  config.after(:each) do
    FileUtils.rm_rf @base_temp_directory_path
  end
end

def decode_avro(schema_string, bytes)
  schema = Avro::Schema.parse(schema_string)
  RFlow::Avro.decode(Avro::IO::DatumReader.new(schema, schema), bytes)
end

def encode_avro(schema_string, message)
  RFlow::Avro.encode(Avro::IO::DatumWriter.new(Avro::Schema.parse(schema_string)), message)
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rflow-1.0.0a2 spec/spec_helper.rb