Class: Test
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- Test
- Defined in:
- app/models/test.rb
Instance Attribute Summary (collapse)
-
- (Object) test_run_count
Returns the value of attribute test_run_count.
Instance Method Summary (collapse)
- - (Object) attributes
- - (Object) check_readiness
- - (Object) create_task
- - (Object) regenerate_url_digest!
Instance Attribute Details
- (Object) test_run_count
Returns the value of attribute test_run_count
21 22 23 |
# File 'app/models/test.rb', line 21 def test_run_count @test_run_count end |
Instance Method Details
- (Object) attributes
23 24 25 |
# File 'app/models/test.rb', line 23 def attributes super.merge('test_run_count' => self.test_run_count) end |
- (Object) check_readiness
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 |
# File 'app/models/test.rb', line 36 def check_readiness if !self.name.blank? self.ready = true num_of_valid_tasks = 0 self.tasks.each do |task| if !task.frozen? self.ready = self.ready && task.ready num_of_valid_tasks += 1 end end self.ready = false if num_of_valid_tasks == 0 else self.ready = false end if self.status != 'running' && self.status != 'finished' unless self.ready self.status = 'invalid' else self.status = 'valid' end end true end |
- (Object) create_task
27 28 29 |
# File 'app/models/test.rb', line 27 def create_task self.tasks << Task.create(name: 'Task 1', project_id: self.project_id) end |
- (Object) regenerate_url_digest!
32 33 34 |
# File 'app/models/test.rb', line 32 def regenerate_url_digest! self.url_digest = RandomDigest.new end |