Sha256: e66cc9a7a401ffd0381631bcb44a71fc63f6137beb017036b296321e8dd4e4b4

Contents?: true

Size: 1002 Bytes

Versions: 9

Compression:

Stored size: 1002 Bytes

Contents

require File.expand_path('../../spec_helper', __FILE__)

describe "Parsi::Date#>>" do
  it "adds the number of months to a Parsi::Date" do
    d = Parsi::Date.civil(1391, 2, 27) >> 10
    d.should == Parsi::Date.civil(1391, 12, 27)
  end

  it "sets the day to the last day of a month if the day doesn't exist" do
    d = Parsi::Date.civil(1391, 6, 31) >> 1
    d.should == Parsi::Date.civil(1391, 7, 30)
  end

  it "raise a TypeError when passed a Symbol" do
    lambda { Parsi::Date.civil(1391, 2, 27) >> :hello }.should raise_error(TypeError)
  end

  it "raise a TypeError when passed a String" do
    lambda { Parsi::Date.civil(1391, 2, 27) >> "hello" }.should raise_error(TypeError)
  end

  it "raise a TypeError when passed a Parsi::Date" do
    lambda { Parsi::Date.civil(1391, 2, 27) >> Parsi::Date.new }.should raise_error(TypeError)
  end

  it "raise a TypeError when passed an Object" do
    lambda { Parsi::Date.civil(1391, 2, 27) >> Object.new }.should raise_error(TypeError)
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
parsi-date-0.2.6 spec/parsi-date/add_month_spec.rb
parsi-date-0.2.5 spec/parsi-date/add_month_spec.rb
parsi-date-0.2.4 spec/parsi-date/add_month_spec.rb
parsi-date-0.2.3 spec/parsi-date/add_month_spec.rb
parsi-date-0.2.2 spec/parsi-date/add_month_spec.rb
parsi-date-0.2.1 spec/parsi-date/add_month_spec.rb
parsi-date-0.2 spec/parsi-date/add_month_spec.rb
parsi-date-0.1 spec/parsi-date/add_month_spec.rb
parsi-date-0.1.pre spec/parsi-date/add_month_spec.rb