Skip to content

Commit

Permalink
respect the [notifier].enabled key
Browse files Browse the repository at this point in the history
  • Loading branch information
svenfuchs committed Jan 16, 2020
1 parent 1a62110 commit 18c6281
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
1 change: 1 addition & 0 deletions lib/travis/addons/config.rb
Expand Up @@ -25,6 +25,7 @@ def key?(key)
def enabled?
return false unless config
return true unless config.respond_to?(:key?)
return false if config.key?(:enabled) && !config[:enabled]
[:disabled, :disable].each { |key| return !config[key] if config.key?(key) } # TODO deprecate disabled and disable
true
end
Expand Down
5 changes: 5 additions & 0 deletions spec/travis/addons/handlers/email_spec.rb
Expand Up @@ -48,6 +48,11 @@
it { expect(handler.handle?).to eql(false) }
end

describe 'is false if enabled is false' do
let(:config) { { enabled: false, recipients: address } }
it { expect(handler.handle?).to eql(false) }
end

describe 'is true if recipients are given in the config' do
let(:config) { { recipients: address } }
it { expect(handler.handle?).to eql(true) }
Expand Down

0 comments on commit 18c6281

Please sign in to comment.