Skip to content

Commit

Permalink
Default should be a list.
Browse files Browse the repository at this point in the history
  • Loading branch information
Roger López committed Jul 5, 2016
1 parent 59ae2ef commit 8c36ba9
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion bin/handler-pagerduty.rb
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ def proxy_settings
end

def contexts
@contexts ||= @event['check']['pagerduty_contexts'] || {}
@contexts ||= @event['check']['pagerduty_contexts'] || []
end

def handle(pd_client = nil)
Expand Down
6 changes: 6 additions & 0 deletions test/bin/handler-pagerduty_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,12 @@ def settings
end

describe '#contexts' do
it 'should return list as default' do
io_obj = fixture('minimal_create.json')
@handler.read_event(io_obj)
expect(@handler.contexts).to eq([])
end

it 'should return contexts hash from check' do
io_obj = fixture('check_with_contexts.json')
@handler.read_event(io_obj)
Expand Down

0 comments on commit 8c36ba9

Please sign in to comment.