Sha256: b43499d8606b90908442d653ae27f3235de4b2d8cd2e338e504ae2f0f8843329

Contents?: true

Size: 926 Bytes

Versions: 2

Compression:

Stored size: 926 Bytes

Contents

describe "Parsi::Date#+" do
  it "adds the number of days to a Parsi::Date" do
    d = Parsi::Date.civil(1391, 2, 27) + 10
    d.should == Parsi::Date.civil(1391, 3, 6)
  end

  it "adds a negative number of days to a Parsi::Date" do
    d = Parsi::Date.civil(1391, 2, 27) + (-10)
    d.should == Parsi::Date.civil(1391, 2, 17)
  end

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

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

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

  it "raises 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

2 entries across 2 versions & 1 rubygems

Version Path
parsi-date-0.3.1 spec/parsi-date/add_spec.rb
parsi-date-0.3.0 spec/parsi-date/add_spec.rb