Class: RspecDelivery::Tracker

Inherits:
Object
  • Object
show all
Defined in:
lib/rspec_delivery/tracker.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeTracker

Returns a new instance of Tracker.



6
7
8
9
10
# File 'lib/rspec_delivery/tracker.rb', line 6

def initialize
	@errors = []
	@successes = []
	@pending = []
end

Instance Attribute Details

#errorsObject

Returns the value of attribute errors.



4
5
6
# File 'lib/rspec_delivery/tracker.rb', line 4

def errors
  @errors
end

#pendingObject

Returns the value of attribute pending.



4
5
6
# File 'lib/rspec_delivery/tracker.rb', line 4

def pending
  @pending
end

#successesObject

Returns the value of attribute successes.



4
5
6
# File 'lib/rspec_delivery/tracker.rb', line 4

def successes
  @successes
end

Instance Method Details

#add(example) ⇒ Object



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/rspec_delivery/tracker.rb', line 12

def add(example)
	# TODO, add exception message (an RSPEC::Expectation::Message obj)
	status = example.execution_result[:status]

	message = {
		description: example.full_description,
		status: status,
		run_time: example.execution_result[:run_time],
		file_path: example.file_path,
		line_number: example.location.split('.rb:')[1]
	}

	if status == "failed"
		@errors << message
	elsif status == "passed"
		@successes << message
	elsif status == "pending"
		@pending << message
	end
	
end