Sha256: 542baab3e81fb4b5e7e98f2c59fec1cd8d4fdb661a745765cd0ac3f4afe491fd

Contents?: true

Size: 1.13 KB

Versions: 7

Compression:

Stored size: 1.13 KB

Contents

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

describe "Parsi::Date#<=>" do
  it "returns 0 when two dates are equal" do
    (Parsi::Date.civil(1391, 4, 6) <=> Parsi::Date.civil(1391, 4, 6)).should == 0
    (Parsi::Date.civil(1391, 4, 6) <=> Date.civil(2012, 6, 26)).should == 0
  end

  it "returns -1 when self is less than another date" do
    (Parsi::Date.civil(1391, 4, 5) <=> Parsi::Date.civil(1391, 4, 6)).should == -1
    (Parsi::Date.civil(1391, 4, 5) <=> Date.civil(2012, 6, 26)).should == -1
  end

  it "returns 1 when self is greater than another date" do
    (Parsi::Date.civil(1392, 4, 7) <=> Parsi::Date.civil(1391, 4, 6)).should == 1
    (Parsi::Date.civil(1391, 4, 7) <=> Date.civil(2012, 6, 26)).should == 1
  end

  it "returns 0 when self is equal to a Numeric" do
    (Parsi::Date.civil(1391, 4, 6) <=> Rational(4912209,2)).should == 0
  end

  it "returns -1 when self is less than a Numeric" do
    (Parsi::Date.civil(1391, 4, 6) <=> Rational(4912210,2)).should == -1
  end

  it "returns 1 when self is greater than a Numeric" do
    (Parsi::Date.civil(1391, 4, 6) <=> Rational(4912208,2)).should == 1
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

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