Sha256: a15fc07ca2066d9dfb1af1666f8d7906d2c4d0300e785b1cf6d258d54315a836

Contents?: true

Size: 718 Bytes

Versions: 1

Compression:

Stored size: 718 Bytes

Contents

require 'spec_helper'

require 'bitmapped/exceptions'

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

    let(:valid_inputs) { ["         A", "B", "C       "] }
    let(:outputs) { ["A", "B", "C"] }

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

  context 'given invalid input' do

    let(:invalid_inputs) { ["2", "!", "a"] }

    it 'should return an error' do
      invalid_inputs.each do |input|
        expect{Validators::ValidationHelper.parse_color(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_helper_spec.rb