Class: RspecN::Run

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(iteration:) ⇒ Run

Returns a new instance of Run.



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

def initialize(iteration:)
  @duration_seconds = nil
  @finish_time = nil
  @has_warnings = nil
  @iteration = iteration
  @result_count_string = nil
  @rspec_stdout = nil
  @rspec_stderr = nil
  @rspec_status = nil
  @seed = nil
  @skipped = false
  @status_string = nil
  @start_time = nil
end

Instance Attribute Details

#duration_secondsObject

Returns the value of attribute duration_seconds.



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

def duration_seconds
  @duration_seconds
end

#finish_timeObject

Returns the value of attribute finish_time.



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

def finish_time
  @finish_time
end

#iterationObject

Returns the value of attribute iteration.



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

def iteration
  @iteration
end

#result_count_stringObject

Returns the value of attribute result_count_string.



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

def result_count_string
  @result_count_string
end

#rspec_statusObject

Returns the value of attribute rspec_status.



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

def rspec_status
  @rspec_status
end

#rspec_stderrObject

Returns the value of attribute rspec_stderr.



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

def rspec_stderr
  @rspec_stderr
end

#rspec_stdoutObject

Returns the value of attribute rspec_stdout.



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

def rspec_stdout
  @rspec_stdout
end

#seedObject

Returns the value of attribute seed.



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

def seed
  @seed
end

#start_timeObject

Returns the value of attribute start_time.



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

def start_time
  @start_time
end

#status_stringObject

Returns the value of attribute status_string.



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

def status_string
  @status_string
end

Instance Method Details

#failed?Boolean

Returns:

  • (Boolean)


63
64
65
# File 'lib/rspec_n/run.rb', line 63

def failed?
  @status_string == "Fail"
end

#formatted_finish_time(format) ⇒ Object



42
43
44
# File 'lib/rspec_n/run.rb', line 42

def formatted_finish_time(format)
  finish_time.strftime(format)
end

#formatted_start_time(format) ⇒ Object



38
39
40
# File 'lib/rspec_n/run.rb', line 38

def formatted_start_time(format)
  start_time.strftime(format)
end

#go(command) ⇒ Object



34
35
36
# File 'lib/rspec_n/run.rb', line 34

def go(command)
  @rspec_stdout, @rspec_stderr, @rspec_status = Open3.capture3(command)
end

#has_warnings?Boolean

Returns:

  • (Boolean)


46
47
48
# File 'lib/rspec_n/run.rb', line 46

def has_warnings?
  @has_warnings
end

#passed?Boolean

Returns:

  • (Boolean)


50
51
52
# File 'lib/rspec_n/run.rb', line 50

def passed?
  @status_string == "Pass"
end

#skipObject



54
55
56
57
# File 'lib/rspec_n/run.rb', line 54

def skip
  @skipped = true
  @duration_seconds = 0
end

#skipped?Boolean

Returns:

  • (Boolean)


59
60
61
# File 'lib/rspec_n/run.rb', line 59

def skipped?
  @skipped
end

#start_clockObject



21
22
23
# File 'lib/rspec_n/run.rb', line 21

def start_clock
  @start_time = Time.now
end

#stop_clockObject



25
26
27
28
29
30
31
32
# File 'lib/rspec_n/run.rb', line 25

def stop_clock
  @finish_time = Time.now
  finalize_duration_seconds
  finalize_seed
  finalize_status_string
  finalize_result_count_string
  finalize_has_warnings
end