Sha256: 5bbf4f545622fd837a356cee910e05a8cfae902b17f8b8da6e0ba68dd29445a1

Contents?: true

Size: 556 Bytes

Versions: 5

Compression:

Stored size: 556 Bytes

Contents

require 'spec_helper'
require 'input_sanitizer/extended_converters/positive_integer_converter'

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

  it "casts string to integer" do
    converter.call("3").should == 3
  end

  it "raises error if integer less than zero" do
    lambda { converter.call("-3") }.should raise_error(InputSanitizer::ConversionError)
  end

  it "raises error if integer equals zero" do
    lambda { converter.call("0") }.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/positive_integer_converter_spec.rb
input_sanitizer-0.5.0 spec/extended_converters/positive_integer_converter_spec.rb
input_sanitizer-0.4.1 spec/extended_converters/positive_integer_converter_spec.rb
input_sanitizer-0.4.0 spec/extended_converters/positive_integer_converter_spec.rb
input_sanitizer-0.3.33 spec/extended_converters/positive_integer_converter_spec.rb