Sha256: 08732a070f1cb8078f68b9002e9f6ef10c7ca2ef705bf34f83dc4b906c15922f

Contents?: true

Size: 721 Bytes

Versions: 1

Compression:

Stored size: 721 Bytes

Contents

require 'spec_helper'

require 'bitmapped/exceptions'

describe Validators::ValidationHelper do

  subject { Validators::ValidationHelper }

  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(subject.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{subject.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.2.0 spec/validators/validate_helper_spec.rb