Sha256: b7e2b2a7437aed2e0cdc59cedd491a0e14376721126a1c3d717f791fbe0e3deb
Contents?: true
Size: 1.02 KB
Versions: 39
Compression:
Stored size: 1.02 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 end
Version data entries
39 entries across 39 versions & 1 rubygems