Don't like ads? PRO users don't see any ads ;-)

date_calculator_spec_5.rb

By: saasbook on May 1st, 2012  |  syntax: Ruby  |  size: 0.68 KB  |  hits: 55  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. require 'date_calculator'
  2. describe DateCalculator do
  3.   it "returns the origin year if fewer than 365 days have passed" do
  4.     years_calculator = DateCalculator.new(origin = 1970)
  5.     years_calculator.current_year_from_days(364).should == 1970
  6.   end
  7.   context "when origin year is a regular year" do
  8.     it "returns one greater than origin year if 366 days have passed" do
  9.       years_calculator = DateCalculator.new(1980)
  10.       years_calculator.current_year_from_days(366).should == 1981
  11.     end
  12.   end
  13.   context "when origin year is a leap year" do
  14.     it "returns the origin year if 366 days have passed"
  15.     it "returns one greater than origin year if more than 366 days have passed"
  16.   end
  17. end