Sha256: f2c80fae480de71ca9ad058163383d81905d4179f997b870add190d1726dc037
Contents?: true
Size: 1.5 KB
Versions: 2
Compression:
Stored size: 1.5 KB
Contents
# encoding: utf-8 require_relative "../../../spec_helper" require "rango/helpers/merb-helpers/date_time_formatting" describe "#strftime_ordinalized" do before(:all) do @date = Date.parse('2008-5-3') @time = Time.parse('2008-5-3 14:00') end it "should ordinalize a date even without a locale passed" do @date.strftime_ordinalized('%b %d, %Y').should == "May 3rd, 2008" end end describe "to_ordinalized_s" do before(:each) do @date = Date.parse('2008-5-3') @time = Time.parse('2008-5-3 14:00') end it "should render a date using #to_s if no format is passed" do @date.to_ordinalized_s.should == @date.to_s end it "should render a time using #to_s if no format is passed" do @time.to_ordinalized_s.should == @time.to_s end it "should render a date or time using the db format" do @date.to_ordinalized_s(:db).should == "2008-05-03 00:00:00" @time.to_ordinalized_s(:db).should == "2008-05-03 14:00:00" end it "should render a date or time using the long format" do @date.to_ordinalized_s(:long).should == "May 3rd, 2008 00:00" @time.to_ordinalized_s(:long).should == "May 3rd, 2008 14:00" end it "should render a date or time using the time format" do @date.to_ordinalized_s(:time).should == "00:00" @time.to_ordinalized_s(:time).should == "14:00" end it "should render a date or a time using the short format" do @date.to_ordinalized_s(:short).should == "3rd May 00:00" @time.to_ordinalized_s(:short).should == "3rd May 14:00" end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
rango-0.0.6 | spec/rango/helpers/merb-helpers/ordinalize_spec.rb |
rango-0.1.pre | spec/rango/helpers/merb-helpers/ordinalize_spec.rb |