Sha256: c50aae1471cd14050f5269ff5c257445db11be87a04060040d730530085612ff

Contents?: true

Size: 1.15 KB

Versions: 1

Compression:

Stored size: 1.15 KB

Contents

require 'timecop'
require_relative '../../../lib/tf1_converter'

module TF1Converter
  describe Translation do
    before do
      execution_time = Time.local(2008, 9, 1, 12, 0, 0)
      Timecop.freeze(execution_time)
    end

    after do
      Timecop.return
    end

    let(:local_dir) { File.dirname(__FILE__) }
    let(:path) { File.expand_path('../../fixtures', local_dir) }

    it "translates a file correctly" do
      input = File.open("#{path}/test.gpx", 'r')
      output = File.open("#{path}/test.kml", 'w')
      expected = File.open("#{path}/expected.kml", 'r')
      TF1Converter::Config.load(File.expand_path('../../../example/config.yml', local_dir))
      TF1Converter::Translation.from(input).into(output)

      result = File.open("#{path}/test.kml", 'r')
      result.read.should == expected.read
    end

    it 'translates a tracks-only file' do
      input = File.open("#{path}/ftwood2.gpx", 'r')
      output = File.open("#{path}/ftwood2.kml", 'w')
      TF1Converter::Config.load(File.expand_path('../../../example/config.yml', local_dir))
      #should not raise error
      TF1Converter::Translation.from(input).into(output)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
tf1_converter-0.3.2 spec/lib/tf1_converter/translation_spec.rb