Class: CiInACan::Run

Inherits:
Object
  • Object
show all
Defined in:
lib/ci_in_a_can/run.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#branchObject

Returns the value of attribute branch.



7
8
9
# File 'lib/ci_in_a_can/run.rb', line 7

def branch
  @branch
end

#build_idObject

Returns the value of attribute build_id.



7
8
9
# File 'lib/ci_in_a_can/run.rb', line 7

def build_id
  @build_id
end

#created_atObject

Returns the value of attribute created_at.



7
8
9
# File 'lib/ci_in_a_can/run.rb', line 7

def created_at
  @created_at
end

#passedObject

Returns the value of attribute passed.



7
8
9
# File 'lib/ci_in_a_can/run.rb', line 7

def passed
  @passed
end

#repoObject

Returns the value of attribute repo.



7
8
9
# File 'lib/ci_in_a_can/run.rb', line 7

def repo
  @repo
end

#shaObject

Returns the value of attribute sha.



7
8
9
# File 'lib/ci_in_a_can/run.rb', line 7

def sha
  @sha
end

#test_result_idObject

Returns the value of attribute test_result_id.



7
8
9
# File 'lib/ci_in_a_can/run.rb', line 7

def test_result_id
  @test_result_id
end

Class Method Details

.add(build, test_result) ⇒ Object



19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/ci_in_a_can/run.rb', line 19

def self.add build, test_result
  data = { 
           created_at:     test_result.created_at,
           test_result_id: test_result.id,
           passed:         test_result.passed,
           build_id:       build.id,
           sha:            build.sha,
           repo:           build.repo,
           branch:         build.branch
         }
  CiInACan::Persistence.save("test_run_list", test_result.created_at, data)
end

.allObject



32
33
34
35
# File 'lib/ci_in_a_can/run.rb', line 32

def self.all
  blah = CiInACan::Persistence.hash_for("test_run_list")
  blah.sort_by { |x| x[0] }.reverse.map { |x| new x[1] }
end

Instance Method Details

#to_htmlObject



15
16
17
# File 'lib/ci_in_a_can/run.rb', line 15

def to_html
  CiInACan::ViewModels::RunViewModel.new(self).to_html
end