Class: CiInACan::TestResult

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

Constant Summary collapse

PERSISTENCE_TYPE =
'test_result'

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#branchObject

Returns the value of attribute branch.



16
17
18
# File 'lib/ci_in_a_can/test_result.rb', line 16

def branch
  @branch
end

#build_idObject

Returns the value of attribute build_id.



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

def build_id
  @build_id
end

#created_atObject

Returns the value of attribute created_at.



14
15
16
# File 'lib/ci_in_a_can/test_result.rb', line 14

def created_at
  @created_at
end

#idObject

Returns the value of attribute id.



12
13
14
# File 'lib/ci_in_a_can/test_result.rb', line 12

def id
  @id
end

#outputObject

Returns the value of attribute output.



13
14
15
# File 'lib/ci_in_a_can/test_result.rb', line 13

def output
  @output
end

#passedObject

Returns the value of attribute passed.



13
14
15
# File 'lib/ci_in_a_can/test_result.rb', line 13

def passed
  @passed
end

#repoObject

Returns the value of attribute repo.



17
18
19
# File 'lib/ci_in_a_can/test_result.rb', line 17

def repo
  @repo
end

Class Method Details

.create(values) ⇒ Object



19
20
21
22
23
# File 'lib/ci_in_a_can/test_result.rb', line 19

def self.create values
  test_result = create_the_test_result_from values
  save_this test_result
  test_result
end

.find(id) ⇒ Object



25
26
27
# File 'lib/ci_in_a_can/test_result.rb', line 25

def self.find id
  CiInACan::Persistence.find PERSISTENCE_TYPE, id
end

Instance Method Details

#output_summaryObject



42
43
44
45
46
# File 'lib/ci_in_a_can/test_result.rb', line 42

def output_summary
  output.split("\n")
        .select { |x| x.to_s.strip != '' }
        .last
end

#to_htmlObject



38
39
40
# File 'lib/ci_in_a_can/test_result.rb', line 38

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

#to_jsonObject



29
30
31
32
33
34
35
36
# File 'lib/ci_in_a_can/test_result.rb', line 29

def to_json
  { 
    id:         id, 
    passed:     passed, 
    output:     output,
    created_at: created_at
  }.to_json
end