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
@@ -1,65 +1,65 | |||
|
1 | 1 | require File.join(File.dirname(__FILE__),'spec_helper') |
|
2 | 2 | require File.join(File.dirname(__FILE__),'engine_spec_helper') |
|
3 | 3 | |
|
4 | 4 | describe "A grader runner, when grade task" do |
|
5 | 5 | |
|
6 | 6 | include GraderEngineHelperMethods |
|
7 | 7 | |
|
8 | 8 | before(:each) do |
|
9 | 9 | @config = Grader::Configuration.get_instance |
|
10 | 10 | @problem_test_normal = stub(Problem, |
|
11 | 11 | :id => 1, :name => 'test_normal', |
|
12 | 12 | :full_score => 135) |
|
13 | 13 | @user_user1 = stub(User, |
|
14 | 14 | :id => 1, :login => 'user1') |
|
15 | 15 | |
|
16 | 16 | @engine = Grader::Engine.new |
|
17 | 17 | @runner = Grader::Runner.new(@engine) |
|
18 | 18 | init_sandbox |
|
19 | 19 | end |
|
20 | 20 | |
|
21 | 21 | it "should just return nil when there is no submission" do |
|
22 | 22 | Task.should_receive(:get_inqueue_and_change_status).and_return(nil) |
|
23 | 23 | @runner.grade_oldest_task.should be_nil |
|
24 | 24 | end |
|
25 | 25 | |
|
26 | 26 | it "should grade oldest task in queue" do |
|
27 | 27 | submission = create_normal_submission_mock_from_file("test1_correct.c") |
|
28 | 28 | |
|
29 | 29 | submission.should_receive(:graded_at=) |
|
30 | 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 | 32 | submission.should_receive(:compiler_message=).with('') |
|
33 | 33 | submission.should_receive(:save) |
|
34 | 34 | |
|
35 | 35 | # mock task |
|
36 | 36 | task = stub(Task,:id => 1, :submission_id => submission.id) |
|
37 | 37 | Task.should_receive(:get_inqueue_and_change_status).and_return(task) |
|
38 | 38 | task.should_receive(:status_complete!) |
|
39 | 39 | |
|
40 | 40 | # mock Submission |
|
41 | 41 | Submission.should_receive(:find). |
|
42 | 42 | with(task.submission_id). |
|
43 | 43 | and_return(submission) |
|
44 | 44 | |
|
45 | 45 | @runner.grade_oldest_task |
|
46 | 46 | end |
|
47 | 47 | |
|
48 | 48 | # to be converted |
|
49 | 49 | def test_grade_oldest_task_with_grader_process |
|
50 | 50 | grader_process = stub |
|
51 | 51 | grader_process.expects(:report_active) |
|
52 | 52 | |
|
53 | 53 | @runner = Grader::Runner.new(@engine,grader_process) |
|
54 | 54 | |
|
55 | 55 | test_grade_oldest_task |
|
56 | 56 | end |
|
57 | 57 | |
|
58 | 58 | protected |
|
59 | 59 | |
|
60 | 60 | def create_normal_submission_mock_from_file(source_fname) |
|
61 | 61 | create_submission_from_file(1, @user_user1, @problem_test_normal, source_fname) |
|
62 | 62 | end |
|
63 | 63 | |
|
64 | 64 | end |
|
65 | 65 |
You need to be logged in to leave comments.
Login now