saasbook

date_calculator_spec_5.rb

Mar 13th, 2014
134
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 0.68 KB | None | 0 0
  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
Add Comment
Please, Sign In to add comment