Sha256: c1126e4d9f3f78c472ffca211ab8bff5b9b1811c649d3795c66af43597467da5

Contents?: true

Size: 1.42 KB

Versions: 1

Compression:

Stored size: 1.42 KB

Contents

require_relative '../lib/gls_agent'

describe 'GLSAgent Module helpers' do
  it 'creates ParcelJob from csv string' do
    job = GLSAgent::job_from_csv '02.02.2014,Name,Street,1,1234,City,1'
    expect(job.date).to eq '02.02.2014'
    expect(job.name).to eq 'Name'
    expect(job.street).to eq 'Street'
    expect(job.streetno).to eq '1'
    expect(job.zip).to eq '1234'
    expect(job.city).to eq 'City'
    expect(job.weight).to eq '1'
  end

  it 'creates ParcelJob from hash' do
    hash = {:date => '02.12.2012', :name => 'Name', :street => 'Street', :streetno => '1', :zip => '1234', :city => 'City', :weight => '1'}
    job = GLSAgent::job_from_hash hash
    expect(job.date).to eq '02.12.2012'
    expect(job.name).to eq 'Name'
    expect(job.street).to eq 'Street'
    expect(job.streetno).to eq '1'
    expect(job.zip).to eq '1234'
    expect(job.city).to eq 'City'
    expect(job.weight).to eq '1'
  end
end

describe 'Dotfile-Parsing' do
  it 'makes a hash from abc=def options' do
    hash = GLSAgent::Dotfile::hash_from_text 'abc=def'
    expect(hash[:abc]).to eq 'def'
  end
  it 'is tolerant about spaces' do
    hash = GLSAgent::Dotfile::hash_from_text ' abc =def '
    expect(hash[:abc]).to eq 'def'
  end
  it 'handles multiple options' do
    hash = GLSAgent::Dotfile::hash_from_text " abc =def \nuser= 123\n pass   = h"
    expect(hash[:abc]).to eq 'def'
    expect(hash[:user]).to eq '123'
    expect(hash[:pass]).to eq 'h'
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
gls_agent-0.3.0 spec/gls_agent_spec.rb