Sha256: ae394a410a4de221badac64e1c375ff9a77685a9e5e4a1da9a55cf261b802057
Contents?: true
Size: 668 Bytes
Versions: 14
Compression:
Stored size: 668 Bytes
Contents
require 'spec_helper' describe Coercer::DateTime, '.to_time' do subject { object.to_time(date_time) } let(:object) { described_class.new } let(:date_time) { DateTime.new(2011, 1, 1) } context 'when DateTime does not support #to_time' do if RUBY_VERSION < '1.9' before do date_time.should_not respond_to(:to_time) end end it { should be_instance_of(Time) } it { should eql(Time.local(2011, 1, 1)) } end context 'when DateTime supports #to_time' do let(:time) { Time.local(2011, 1, 1) } before do date_time.stub!(:to_time).and_return(time) end it { should equal(time) } end end
Version data entries
14 entries across 12 versions & 4 rubygems