Class: Sweet::Run

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(opts = {}) ⇒ Run

Returns a new instance of Run.



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/sweet/run.rb', line 6

def initialize(opts = {})
  @name = opts[:name]
  @category = opts[:category]
  @description = opts[:description]
  @tags = opts[:tags] || []
  @duration = 0.0
  @timestamp = opts[:timestamp] || Time.now

  @tests = []
  @passed = []
  @failed = []
  @skipped = []
  @pending = []

  organize_tests opts[:tests] || []
end

Instance Attribute Details

#categoryObject

Returns the value of attribute category.



3
4
5
# File 'lib/sweet/run.rb', line 3

def category
  @category
end

#descriptionObject

Returns the value of attribute description.



3
4
5
# File 'lib/sweet/run.rb', line 3

def description
  @description
end

#failedObject

Returns the value of attribute failed.



4
5
6
# File 'lib/sweet/run.rb', line 4

def failed
  @failed
end

#nameObject

Returns the value of attribute name.



3
4
5
# File 'lib/sweet/run.rb', line 3

def name
  @name
end

#passedObject

Returns the value of attribute passed.



4
5
6
# File 'lib/sweet/run.rb', line 4

def passed
  @passed
end

#pendingObject

Returns the value of attribute pending.



4
5
6
# File 'lib/sweet/run.rb', line 4

def pending
  @pending
end

#skippedObject

Returns the value of attribute skipped.



4
5
6
# File 'lib/sweet/run.rb', line 4

def skipped
  @skipped
end

#tagsObject

Returns the value of attribute tags.



3
4
5
# File 'lib/sweet/run.rb', line 3

def tags
  @tags
end

#testsObject

Returns the value of attribute tests.



4
5
6
# File 'lib/sweet/run.rb', line 4

def tests
  @tests
end

#timestampObject

Returns the value of attribute timestamp.



3
4
5
# File 'lib/sweet/run.rb', line 3

def timestamp
  @timestamp
end

Instance Method Details

#durationObject



23
24
25
# File 'lib/sweet/run.rb', line 23

def duration
  @duration / 1_000_000_000 # nanoseconds
end

#total_failedObject



35
36
37
# File 'lib/sweet/run.rb', line 35

def total_failed
  @failed.count
end

#total_passedObject



31
32
33
# File 'lib/sweet/run.rb', line 31

def total_passed
  @passed.count
end

#total_pendingObject



43
44
45
# File 'lib/sweet/run.rb', line 43

def total_pending
  @pending.count
end

#total_skippedObject



39
40
41
# File 'lib/sweet/run.rb', line 39

def total_skipped
  @skipped.count
end

#total_testsObject



27
28
29
# File 'lib/sweet/run.rb', line 27

def total_tests
  @tests.count
end