Sha256: ed915a7fb1a0e02ade8a30e0ab7e15429fdf47c0b2cdb364a17f8b88f72adcc0

Contents?: true

Size: 895 Bytes

Versions: 2

Compression:

Stored size: 895 Bytes

Contents

require 'spec_helper'
require 'gyomu_ruby/core_ext/time'

describe Time, 'gyomu_ruby extentions' do
  describe '#biz_year' do
    context 'default boundary' do
      specify { Time.local(2011, 4, 1).biz_year.should == 2011 }
      specify { Time.local(2011,12,31).biz_year.should == 2011 }
      specify { Time.local(2012, 1, 1).biz_year.should == 2011 }
      specify { Time.local(2012, 3,31).biz_year.should == 2011 }
    end

    context 'custom boundary at 4/2' do
      specify { Time.local(2011, 4, 1).biz_year(4, 2).should == 2010 }
      specify { Time.local(2011, 4, 2).biz_year(4, 2).should == 2011 }
    end

    context 'custom boundary at 3/31' do
      specify { Time.local(2011, 3,30).biz_year(3, 31).should == 2010 }
      specify { Time.local(2011, 3,31).biz_year(3, 31).should == 2011 }
      specify { Time.local(2011, 4, 1).biz_year(3, 31).should == 2011 }
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
gyomu_ruby-0.0.5 spec/core_ext/time_spec.rb
gyomu_ruby-0.0.4 spec/core_ext/time_spec.rb