Show More
Commit Description:
added message hiding for admin in msg console...
Commit Description:
added message hiding for admin in msg console
git-svn-id: http://theory.cpe.ku.ac.th/grader/web/trunk@371 6386c4cd-e34a-4fa8-8920-d93eb39b512e
References:
File last commit:
Show/Diff file:
Action:
spec/models/submission_spec.rb
| 37 lines
| 942 B
| text/x-ruby
| RubyLexer
|
|
r62 | |||
require File.dirname(__FILE__) + '/../spec_helper' | ||||
|
r64 | describe Submission, "when verifying user submission" do | ||
|
r62 | |||
before(:each) do | ||||
@submission = Submission.new | ||||
@submission.source = <<SOURCE | ||||
/* | ||||
LANG: C++ | ||||
TASK: testproblem | ||||
*/ | ||||
SOURCE | ||||
end | ||||
it "should find language in source" do | ||||
langcpp = stub(Language, :name => 'cpp', :ext => 'cpp') | ||||
Language.should_receive(:find_by_name).with('C++').and_return(langcpp) | ||||
Submission.find_language_in_source(@submission.source).should == langcpp | ||||
end | ||||
it "should find problem in source, when there is any" do | ||||
problem = stub(Problem, :name => 'testproblem') | ||||
Problem.should_receive(:find_by_name).with('testproblem').and_return(problem) | ||||
Submission.find_problem_in_source(@submission.source).should == problem | ||||
end | ||||
it "should return nil when it cannot find problem in source" do | ||||
Submission.find_problem_in_source(<<SOURCE | ||||
/* | ||||
LANG: C | ||||
*/ | ||||
SOURCE | ||||
).should == nil | ||||
end | ||||
end | ||||