0
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
0
describe FrontHelper do
0
- #Delete this example and add some real ones or delete this file
0
- it "should be included in the object returned by #helper" do
0
- included_modules = (class << helper; self; end).send :included_modules
0
- included_modules.should include(FrontHelper)
0
+ # TODO: change the tests so that it is not tied to the particular day of the week
0
+ describe "next_meeting_date (Wednesday)" do
0
+ it "should return last Wednesday for month ending on a Wednesday" do
0
+ mock_today = Date.new(2008,12,1)
0
+ last_wednesday = mock_today.end_of_month
0
+ Date.stub!(:today).and_return(mock_today)
0
+ next_meeting_date.should eql(last_wednesday)
0
+ it "should return last Wednesday for month ending on a Thursday" do
0
+ mock_today = Date.new(2008,7,1)
0
+ last_wednesday = mock_today.end_of_month - 1.day
0
+ Date.stub!(:today).and_return(mock_today)
0
+ next_meeting_date.should eql(last_wednesday)
0
+ it "should return last Wednesday for month ending on a Friday" do
0
+ mock_today = Date.new(2008,10,1)
0
+ last_wednesday = mock_today.end_of_month - 2.days
0
+ Date.stub!(:today).and_return(mock_today)
0
+ next_meeting_date.should eql(last_wednesday)
0
+ it "should return last Wednesday for month ending on a Saturday" do
0
+ mock_today = Date.new(2008,5,1)
0
+ last_wednesday = mock_today.end_of_month - 3.days
0
+ Date.stub!(:today).and_return(mock_today)
0
+ next_meeting_date.should eql(last_wednesday)
0
+ it "should return last Wednesday for month ending on a Sunday" do
0
+ mock_today = Date.new(2008,8,1)
0
+ last_wednesday = mock_today.end_of_month - 4.days
0
+ Date.stub!(:today).and_return(mock_today)
0
+ next_meeting_date.should eql(last_wednesday)
0
+ it "should return last Wednesday for month ending on a Monday" do
0
+ mock_today = Date.new(2008,6,1)
0
+ last_wednesday = mock_today.end_of_month - 5.days
0
+ Date.stub!(:today).and_return(mock_today)
0
+ next_meeting_date.should eql(last_wednesday)
0
+ it "should return last Wednesday for month ending on a Tuesday" do
0
+ mock_today = Date.new(2008,9,1)
0
+ last_wednesday = mock_today.end_of_month - 6.days
0
+ Date.stub!(:today).and_return(mock_today)
0
+ next_meeting_date.should eql(last_wednesday)