Skip to content

Instantly share code, notes, and snippets.

@benlieb
Created January 11, 2014 21:28
Show Gist options
  • Save benlieb/8377118 to your computer and use it in GitHub Desktop.
Save benlieb/8377118 to your computer and use it in GitHub Desktop.
describe "#years" do
it "should return a list of years" do
Time.stub(:now).and_return Time.parse("2005-01-01")
Membership.years.should == [["04-05",2004], ["05-06",2005], ["06-07",2006], ["07-08",2007]]
Time.stub(:now).and_return Time.parse("2007-01-01")
Membership.years.should == [["06-07",2006], ["07-08",2007], ["08-09",2008], ["09-10",2009]]
end
end
describe "#current_year" do
it "returns the correct year for may" do
Time.stub(:now).and_return(Time.parse("05/05/2005"))
Membership.current_year.should == "04-05"
end
it "returns the correct year for september" do
Time.stub(:now).and_return(Time.parse("09/05/2005"))
Membership.current_year.should == "05-06"
end
#it "returns the correct year for july 31st" do
#Time.stub(:now).and_return(Time.parse("05/05/2005"))
#Membership.current_year.should == "04-05"
#end
#it "returns the correct year for august 1st" do
#Time.stub(:now).and_return(Time.parse("08/01/2005"))
#Membership.current_year.should == "05-06"
#end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment