Description:
[web] more files (cont. from rev 159) git-svn-id: http://theory.cpe.ku.ac.th/grader/web/trunk@160 6386c4cd-e34a-4fa8-8920-d93eb39b512e
Commit status:
[Not Reviewed]
References:
Comments:
0 Commit comments 0 Inline Comments
Unresolved TODOs:
There are no unresolved TODOs
Add another comment

r80:11832580676a - - 2 files changed: 55 inserted, 0 deleted

@@ -0,0 +1,27
1 + = user_title_bar(@user)
2 +
3 + %div{:style => "text-align: center"}
4 + = "Problem: #{@test_request.problem.full_name}"
5 + %br/
6 + = "Submission: #{@test_request.submission.number}"
7 + %br/
8 + = "Test submitted at: #{format_short_time(@test_request.submitted_at)}"
9 + %br/
10 + = simple_format((@test_request.running_stat or ''))
11 +
12 + - if @test_request.compiler_message!=nil and @test_request.compiler_message!=''
13 + %b Compiler Message
14 + %div{:style => "border: 1px solid black; background: lightgrey"}
15 + = simple_format((@test_request.compiler_message or ''))
16 +
17 + %b Input
18 + %div{:style => "border: 1px solid black; background: lightgrey"}
19 + - if @test_request.input_file_name!=nil
20 + = simple_format(read_textfile(@test_request.input_file_name,2048))
21 +
22 + %b Output
23 + %div{:style => "border: 1px solid black; background: lightgrey"}
24 + - if @test_request.output_file_name!=nil
25 + = simple_format(read_textfile(@test_request.output_file_name,2048))
26 + - else
27 + (no output)
@@ -0,0 +1,28
1 +
2 + require File.dirname(__FILE__) + '/../spec_helper'
3 +
4 + describe TestController do
5 +
6 + before(:each) do
7 + @john = mock(User, :id => "1", :login => 'john')
8 + @john_result = mock(TestRequest, :id => "1", :user_id => @john.id)
9 + @mary_result = mock(TestRequest, :id => "2", :user_id => @john.id + '1')
10 + User.should_receive(:find).with(@john.id).and_return(@john)
11 + end
12 +
13 + it "should let user see her testing result" do
14 + TestRequest.should_receive(:find).with(@john_result.id).
15 + and_return(@john_result)
16 + get 'result', {:id => @john_result.id}, {:user_id => @john.id}
17 + response.should be_success
18 + end
19 +
20 + it "should not let user see other's testing result" do
21 + TestRequest.should_receive(:find).with(@mary_result.id).
22 + and_return(@mary_result)
23 + get 'result', {:id => @mary_result.id}, {:user_id => @john.id}
24 + response.should redirect_to(:action => 'index')
25 + end
26 +
27 + end
28 +
You need to be logged in to leave comments. Login now