Show More
Commit Description:
fix logins user_id from string to integer
Commit Description:
fix logins user_id from string to integer
References:
File last commit:
Show/Diff file:
Action:
test/unit/task_test.rb
| 41 lines
| 1.2 KiB
| text/x-ruby
| RubyLexer
|
|
r0 | require File.dirname(__FILE__) + '/../test_helper' | ||
class TaskTest < Test::Unit::TestCase | ||||
fixtures :tasks | ||||
|
r30 | self.use_transactional_fixtures = false | ||
def test_get_inqueue_simple | ||||
task1 = Task.get_inqueue_and_change_status(Task::STATUS_GRADING) | ||||
assert_equal task1.id, 3, "should get the earliest task" | ||||
assert_equal task1.status, Task::STATUS_GRADING, "status changes" | ||||
task2 = Task.get_inqueue_and_change_status(Task::STATUS_GRADING) | ||||
assert_equal task2.id, 4, "should get the next task" | ||||
assert_equal task2.status, Task::STATUS_GRADING, "status changes" | ||||
|
r0 | end | ||
|
r30 | |||
def generate_tasks(n) | ||||
n.times do |i| | ||||
Task.create(:submission_id => i, | ||||
:status => Task::STATUS_INQUEUE, | ||||
:create_at => Time.now + i.minutes) | ||||
end | ||||
end | ||||
# use the process version in /test/concurrent instead | ||||
def UNUSED_test_get_inqueue_concurrent | ||||
ActiveRecord::Base.allow_concurrency = true | ||||
task1 = Task.get_inqueue_and_change_status(Task::STATUS_GRADING) | ||||
assert_equal task1.id, 3, "should get the earliest task" | ||||
assert_equal task1.status, Task::STATUS_GRADING, "status changes" | ||||
ActiveRecord::Base.verify_active_connections! | ||||
end | ||||
|
r0 | end | ||
|
r30 | |||