require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
describe ApplicationHelper do
describe "should set the proper html title string" do
it "if the string is blank, it should yield nothing" do
helper.set_html_title(nil).should == nil
end
it "if the string is a valid string, it should yield the string" do
helper.set_html_title("test").should == "test"
end
end
#TODO these are weak/inaccurate specs. These are more-or-less stubs
describe "should find the current announcements" do
it "when the session['announcement_hide_time'] is not nil" do
session['announcement_hide_time'] = Time.now.utc
current_announcements.should == Announcement.current_announcements(session['announcement_hide_time'])
end
it "when the session['announcement_hide_time'] is nil and cookies['announcement_hide_time'] is not nil" do
session['announcement_hide_time'] = nil
# cookies['announcement_hide_time'] = CGI::Cookie.new('announcement_hide_time', Time.now.utc.to_datetime.to_s)
time = Time.now.utc
request.cookies['announcement_hide_time'] = {:value => time.to_datetime.to_s,
:expires => time.next_week}
# current_announcements.should == Announcement.current_announcements(cookies['announcement_hide_time'].value.first.to_datetime)
end
it "when the session['announcement_hide_time'] and cookies['announcement_hide_time'] are not nil" do
session['announcement_hide_time'] = nil
cookies['announcement_hide_time'] = nil
current_announcements.should == Announcement.current_announcements(nil)
end
end
end