Sha256: ef9d2e87df8ef26395979ad3a59083bc2c20bd22fda154829fd84457ebe27f05

Contents?: true

Size: 782 Bytes

Versions: 1

Compression:

Stored size: 782 Bytes

Contents

require 'spec_helper'

require 'bitmapped/exceptions'

describe Validators::ValidateColumnRowInput do

  subject { Validators::ValidateColumnRowInput }

  context 'given valid input' do

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

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

  context 'given invalid input' do

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

    it 'should return an error' do
      invalid_inputs.each do |input|
        expect{subject.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.2.0 spec/validators/validate_column_row_input_spec.rb