Sha256: cc65d14b5dc85efa9dd09335f8bd4fdaffdd41e0afba444b3dffd3f88f9bd0c8

Contents?: true

Size: 497 Bytes

Versions: 5

Compression:

Stored size: 497 Bytes

Contents

require 'spec_helper'

describe Virtus::Coercion::String, '.to_date' do
  subject { object.to_date(string) }

  let(:object) { described_class }

  context 'with a valid date string' do
    let(:string) { "July, 22th, 2011" }

    it { should be_instance_of(Date) }

    its(:year)  { should == 2011 }
    its(:month) { should == 7    }
    its(:day)   { should == 22   }
  end

  context 'with an invalid date string' do
    let(:string) { 'non-date' }

    it { should equal(string) }
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
virtus-0.0.10 spec/unit/virtus/coercion/string/class_methods/to_date_spec.rb
virtus-0.0.9 spec/unit/virtus/coercion/string/class_methods/to_date_spec.rb
virtus-0.0.8 spec/unit/virtus/coercion/string/class_methods/to_date_spec.rb
virtus-0.0.7 spec/unit/virtus/coercion/string/class_methods/to_date_spec.rb
virtus-0.0.6 spec/unit/virtus/coercion/string/class_methods/to_date_spec.rb