Commit 4c646196 authored by Antonio Terceiro's avatar Antonio Terceiro

Fix handling of blame with "unknown" as value

Will avoid crashing when generating indexes
parent 0af1b960
debci (0.7.1) unstable; urgency=medium
* Fix handling of blame with "unknown" as value. Will avoid crashing when
generating indexes
-- Antonio Terceiro <terceiro@debian.org> Mon, 09 Jun 2014 11:07:11 -0300
debci (0.7) unstable; urgency=medium
[ Antonio Terceiro ]
......
......@@ -7,7 +7,8 @@ module Debci
class Status
attr_accessor :suite, :architecture, :run_id, :package, :version, :date, :status, :blame, :previous_status, :duration_seconds, :duration_human, :message
attr_reader :blame
attr_accessor :suite, :architecture, :run_id, :package, :version, :date, :status, :previous_status, :duration_seconds, :duration_human, :message
# Returns `true` if this status object represents an important event, such
# as a package that used to pass started failing, of vice versa.
......@@ -38,6 +39,14 @@ module Debci
"The tests for #{package} #{status.upcase}ED on #{suite}/#{architecture} but have previosly #{previous_status.upcase}ED."
end
def blame=(value)
if value.is_a?(Array)
@blame = value
else
@blame = []
end
end
# Constructs a new object by reading the JSON status `file`.
def self.from_file(file)
status = new
......
......@@ -107,6 +107,12 @@ describe Debci::Status do
end
end
context 'unknown blame' do
it 'is always an Array' do
expect(status_with(blame: 'unknown').blame).to be_a(Array)
end
end
def status_with(data)
s = Debci::Status.new
data.each do |k,v|
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment