Sha256: 8904244605d2c3bea3cc816e0d04620ed519525db1982cd2ab0530ef2db8f355

Contents?: true

Size: 869 Bytes

Versions: 1

Compression:

Stored size: 869 Bytes

Contents

require 'spec_helper'

require 'bitmapped/exceptions'

describe Validators::ValidateSegmentInput do
  context 'given valid input' do

    let(:valid_inputs) { [["2", "2", "2", "C"], ["2", "3", "3", "X"], ["10", "99", "1000", "Y"]] }
    let(:outputs) { [[2, 2, 2, "C"], [2, 3, 3, "X"], [10, 99, 1000, "Y"]] }

    it 'should return an array of parsed values' do
      valid_inputs.each_with_index do |input, index|
        expect(Validators::ValidateSegmentInput.parse_and_validate(input)).to eq(outputs[index])
      end
    end
  end

  context 'given invalid input' do

    let(:invalid_inputs) { [["A", "2", "2", "2"], ["2", "2", "2", "2"], ["99", "50","Z"]] }

    it 'should return an error' do
      invalid_inputs.each do |input|
        expect{Validators::ValidateSegmentInput.parse_and_validate(input)}.to raise_error(ParsingError)
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
bitmapped-0.1.0 spec/validators/validate_segment_input_spec.rb