Sha256: 57578f8c532228f7a67d6847ebc219f8758bf138b7be0331ae55fc60b9b1a977
Contents?: true
Size: 603 Bytes
Versions: 10
Compression:
Stored size: 603 Bytes
Contents
require 'test_helper' require 'roar/representer/feature/coercion' class CoercionFeatureTest < MiniTest::Spec describe "Coercion" do class ImmigrantSong include Roar::Representer::JSON include Roar::Representer::Feature::Coercion property :composed_at, :type => DateTime, :default => "May 12th, 2012" attr_accessor :composed_at end it "coerces into the provided type" do song = ImmigrantSong.new.from_json("{\"composed_at\":\"November 18th, 1983\"}") assert_equal DateTime.parse("Fri, 18 Nov 1983 00:00:00 +0000"), song.composed_at end end end
Version data entries
10 entries across 10 versions & 1 rubygems