Show More
Commit Description:
Merge pull request #15 from nattee/master...
Commit Description:
Merge pull request #15 from nattee/master finalizing merge of nattee's master
References:
File last commit:
Show/Diff file:
Action:
spec/models/site_spec.rb | 48 lines | 1.7 KiB | text/x-ruby | RubyLexer |
jittat
[web] added site and time out basic functionality...
r85
require File.dirname(__FILE__) + '/../spec_helper'
describe Site do
before(:each) do
jittat
Merged online-registration branch changes r297:303 into the trunk...
r158 start_time = Time.local(2008,5,10,9,00).gmtime
jittat
[web] added site and time out basic functionality...
r85 @site = Site.new({:name => 'Test site',
:started => true,
:start_time => start_time })
jittat
Merged online-registration branch changes r297:303 into the trunk...
r158 @site.stub!(:start_time).
any_number_of_times.
and_return(start_time)
@site.stub!(:started).any_number_of_times.and_return(true)
jittat
[web] added site and time out basic functionality...
r85 end
it "should report that the contest is not finished when the contest time limit is not set" do
Configuration.should_receive(:[]).with('contest.time_limit').
and_return('unlimit')
@site.finished?.should == false
end
it "should report that the contest is finished when the contest is over" do
Configuration.should_receive(:[]).with('contest.time_limit').
jittat
Merged online-registration branch changes r297:303 into the trunk...
r158 and_return('5:00')
Time.stub!(:now).
and_return(Time.local(2008,5,10,14,01).gmtime)
@site.finished?.should == true end
jittat
[web] added site and time out basic functionality...
r85
it "should report if the contest is finished correctly, when the contest is over, and the contest time contains some minutes" do
Configuration.should_receive(:[]).twice.with('contest.time_limit').
and_return('5:15')
jittat
Merged online-registration branch changes r297:303 into the trunk...
r158 Time.stub!(:now).
and_return(Time.local(2008,5,10,14,14))
jittat
[web] added site and time out basic functionality...
r85 @site.finished?.should == false
jittat
Merged online-registration branch changes r297:303 into the trunk...
r158 Time.stub!(:now).
and_return(Time.local(2008,5,10,14,16))
jittat
[web] added site and time out basic functionality...
r85 @site.finished?.should == true
end
it "should report that the contest is not finished, when the time is exactly at the finish time" do
Configuration.should_receive(:[]).with('contest.time_limit').
and_return('5:00')
jittat
Merged online-registration branch changes r297:303 into the trunk...
r158 Time.stub!(:now).and_return(Time.local(2008,5,10,14,00))
jittat
[web] added site and time out basic functionality...
r85 @site.finished?.should == false
end
end