Sha256: 6ad6005a835b65f28fecf59adaca01dfe6dec72e0202f69ed7ce5d78d6c1a46a

Contents?: true

Size: 982 Bytes

Versions: 9

Compression:

Stored size: 982 Bytes

Contents

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

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

9 entries across 9 versions & 1 rubygems

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