Sha256: f5f969b1287f208d441b5d09e680f80d8e5066825cae8728e0d7c34b3f9e82bc
Contents?: true
Size: 744 Bytes
Versions: 5
Compression:
Stored size: 744 Bytes
Contents
require 'spec_helper' require 'input_sanitizer/extended_converters/specific_values_converter' describe InputSanitizer::SpecificValuesConverter do let(:converter) { described_class.new(values) } let(:values) { [:a, :b] } it "converts valid value to symbol" do converter.call("b").should eq(:b) end it "raises on invalid value" do lambda { converter.call("c") }.should raise_error(InputSanitizer::ConversionError) end it "raises on nil value" do lambda { converter.call(nil) }.should raise_error(InputSanitizer::ConversionError) end context "when specific values are strings" do let(:values) { ["a", "b"] } it "keeps given value as string" do converter.call("a").should eq("a") end end end
Version data entries
5 entries across 5 versions & 1 rubygems