Description:
updated runner_spec
git-svn-id: http://theory.cpe.ku.ac.th/grader/judge/trunk/scripts@418 6386c4cd-e34a-4fa8-8920-d93eb39b512e
Commit status:
[Not Reviewed]
References:
Diff options:
Comments:
0 Commit comments
0 Inline Comments
Unresolved TODOs:
There are no unresolved TODOs
r77:b0f4f829e914 - - 1 file changed: 1 inserted, 1 deleted
@@ -19,25 +19,25 | |||||
|
19 | end |
|
19 | end |
|
20 |
|
20 | ||
|
21 | it "should just return nil when there is no submission" do |
|
21 | it "should just return nil when there is no submission" do |
|
22 | Task.should_receive(:get_inqueue_and_change_status).and_return(nil) |
|
22 | Task.should_receive(:get_inqueue_and_change_status).and_return(nil) |
|
23 | @runner.grade_oldest_task.should be_nil |
|
23 | @runner.grade_oldest_task.should be_nil |
|
24 | end |
|
24 | end |
|
25 |
|
25 | ||
|
26 | it "should grade oldest task in queue" do |
|
26 | it "should grade oldest task in queue" do |
|
27 | submission = create_normal_submission_mock_from_file("test1_correct.c") |
|
27 | submission = create_normal_submission_mock_from_file("test1_correct.c") |
|
28 |
|
28 | ||
|
29 | submission.should_receive(:graded_at=) |
|
29 | submission.should_receive(:graded_at=) |
|
30 | submission.should_receive(:points=).with(135) |
|
30 | submission.should_receive(:points=).with(135) |
|
31 |
- submission.should_receive(:grader_comment=).with( |
|
31 | + submission.should_receive(:grader_comment=).with("[PP][PPPPP][PPP]") |
|
32 | submission.should_receive(:compiler_message=).with('') |
|
32 | submission.should_receive(:compiler_message=).with('') |
|
33 | submission.should_receive(:save) |
|
33 | submission.should_receive(:save) |
|
34 |
|
34 | ||
|
35 | # mock task |
|
35 | # mock task |
|
36 | task = stub(Task,:id => 1, :submission_id => submission.id) |
|
36 | task = stub(Task,:id => 1, :submission_id => submission.id) |
|
37 | Task.should_receive(:get_inqueue_and_change_status).and_return(task) |
|
37 | Task.should_receive(:get_inqueue_and_change_status).and_return(task) |
|
38 | task.should_receive(:status_complete!) |
|
38 | task.should_receive(:status_complete!) |
|
39 |
|
39 | ||
|
40 | # mock Submission |
|
40 | # mock Submission |
|
41 | Submission.should_receive(:find). |
|
41 | Submission.should_receive(:find). |
|
42 | with(task.submission_id). |
|
42 | with(task.submission_id). |
|
43 | and_return(submission) |
|
43 | and_return(submission) |
You need to be logged in to leave comments.
Login now