Show More
Commit Description:
updated db/schema.rb: removed unused tables
Commit Description:
updated db/schema.rb: removed unused tables
File last commit:
Show/Diff file:
Action:
spec/controllers/main_controller_spec.rb | 56 lines | 2.1 KiB | text/x-ruby | RubyLexer |
jittat
[web] added main_controller_spec...
r71
require File.dirname(__FILE__) + '/../spec_helper'
describe MainController do
before(:each) do
jittat
Merged online-registration branch changes r297:303 into the trunk...
r158 @problem = mock(Problem, :name => 'test', :output_only => false)
jittat
[web] added main_controller_spec...
r71 @language = mock(Language, :name => 'cpp', :ext => 'cpp')
@submission = mock(Submission,
:id => 1,
:user_id => 1,
:problem => @problem,
:language => @language,
:source => 'sample source',
:compiler_message => 'none')
@user = mock(User, :id => 1, :login => 'john')
jittat
Merged online-registration branch changes r297:303 into the trunk...
r158 @another_user = mock(User, :id => 2, :login => 'mary')
jittat
[web] add test result page...
r79 end
it "should redirect user to login page when unlogged-in user try to access main/list" do
get 'list'
response.should redirect_to(:action => 'login')
jittat
[web] added main_controller_spec...
r71 end
it "should let user sees her own source" do
jittat
[web] add test result page...
r79 Submission.should_receive(:find).with(@submission.id.to_s).and_return(@submission)
jittat
Merged online-registration branch changes r297:303 into the trunk...
r158 User.should_receive(:find).with(1).and_return(@user)
Jittat Fakcharoenphol
started cleaning up tests, fixed fixtures loading error, removed error when contest time limit is uninitialized
r275 @user.should_receive(:update_start_time)
jittat
[web] added configurations...
r76 get 'source', {:id => @submission.id}, {:user_id => 1}
jittat
[web] added main_controller_spec...
r71 response.should be_success
end
it "should let user sees her own compiler message" do
jittat
[web] add test result page...
r79 Submission.should_receive(:find).with(@submission.id.to_s).and_return(@submission)
jittat
Merged online-registration branch changes r297:303 into the trunk...
r158 User.should_receive(:find).with(1).and_return(@user)
jittat
[web] added configurations...
r76 get 'compiler_msg', {:id => @submission.id}, {:user_id => 1}
jittat
[web] added main_controller_spec...
r71 response.should be_success
end
it "should not let user sees other user's source" do
jittat
[web] add test result page...
r79 Submission.should_receive(:find).with(@submission.id.to_s).and_return(@submission)
jittat
Merged online-registration branch changes r297:303 into the trunk...
r158 User.should_receive(:find).with(2).and_return(@another_user)
jittat
[web] added configurations...
r76 get 'source', {:id => @submission.id}, {:user_id => 2}
jittat
[web] added main_controller_spec...
r71 flash[:notice].should =~ /[Ee]rror/
response.should redirect_to(:action => 'list')
end
it "should not let user sees other user's compiler message" do
jittat
[web] add test result page...
r79 Submission.should_receive(:find).with(@submission.id.to_s).and_return(@submission)
jittat
Merged online-registration branch changes r297:303 into the trunk...
r158 User.should_receive(:find).with(2).and_return(@another_user)
jittat
[web] added configurations...
r76 get 'compiler_msg', {:id => @submission.id}, {:user_id => 2}
jittat
[web] added main_controller_spec...
r71 flash[:notice].should =~ /[Ee]rror/
response.should redirect_to(:action => 'list')
end
end