File size: 667 Bytes
def1299
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
FactoryGirl.define do
  factory :valid_submission, class: Submission do
    sequence(:token) { |n| SecureRandom.uuid + "-#{n}" }
    source_code 'name = gets.strip; puts "hello, " + name'
    language_id { create(:language).id }
    number_of_runs 1
    stdin "world"
    expected_output "hello, world"
  end

  factory :submission, parent: :valid_submission do
    stdout "hello, world"
    status_id 1
    time 1.0
    memory 256
  end

  factory :invalid_submission, class: Submission do
    source_code 'name = gets.strip; puts "hello, " + name'
    # language_id 14 # :language_id should be present
    stdin "world"
    expected_output "hello, world"
  end
end