Sha256: a002f32c7652d14471c44c28a1c20a62343a9bf0ed4ff1de3b1469e2868fb61d
Contents?: true
Size: 1.16 KB
Versions: 54
Compression:
Stored size: 1.16 KB
Contents
require 'spec_helper' class AttributeParsingExampleBase include Flexirest::AttributeParsing def test(v) parse_attribute_value(v) end end describe Flexirest::AttributeParsing do let(:subject) { AttributeParsingExampleBase.new } it "should parse datetimes" do expect(subject.test("1980-12-24T00:00:00.000Z")).to be_a(DateTime) end it "should not parse a multiline string as a datetime" do expect(subject.test("not a datetime\n1980-12-24T00:00:00.000Z")).to be_a(String) end it "should parse dates" do expect(subject.test("1980-12-24")).to be_a(Date) end it "should not parse a multiline string as a datetime" do expect(subject.test("not a date\n1980-12-24")).to be_a(String) end it "should return strings for string values" do expect(subject.test("1980-12")).to eq("1980-12") end it "should return integers for integer values" do expect(subject.test(1980)).to eq(1980) end it "should return floats for float values" do expect(subject.test(1980.12)).to eq(1980.12) end it "should return as a string a date-like string that can't be parsed" do expect(subject.test("7/29/2018")).to eq("7/29/2018") end end
Version data entries
54 entries across 54 versions & 1 rubygems