Sha256: d1f71b6fc7acfd50e3835bf94cb89db3407556d36dc2320a11b7140ce87b751e

Contents?: true

Size: 522 Bytes

Versions: 5

Compression:

Stored size: 522 Bytes

Contents

require 'spec_helper'
require 'input_sanitizer/extended_converters/comma_joined_integers_converter'

describe InputSanitizer::CommaJoinedIntegersConverter do
  let(:converter) { described_class.new }

  it "parses to array of ids" do
    converter.call("1,2,3,5").should eq([1, 2, 3, 5])
  end

  it "converts to array if given an integer" do
    converter.call(7).should eq([7])
  end

  it "raises on invalid character" do
    lambda { converter.call(":") }.should raise_error(InputSanitizer::ConversionError)
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
input_sanitizer-0.6.0 spec/extended_converters/comma_joined_integers_converter_spec.rb
input_sanitizer-0.5.0 spec/extended_converters/comma_joined_integers_converter_spec.rb
input_sanitizer-0.4.1 spec/extended_converters/comma_joined_integers_converter_spec.rb
input_sanitizer-0.4.0 spec/extended_converters/comma_joined_integers_converter_spec.rb
input_sanitizer-0.3.33 spec/extended_converters/comma_joined_integers_converter_spec.rb