Skip to content

Commit

Permalink
Fix repeated definition of base_context#failed
Browse files Browse the repository at this point in the history
  • Loading branch information
James Stocks committed Oct 9, 2017
1 parent f1199eb commit 9090538
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 7 deletions.
4 changes: 0 additions & 4 deletions lib/puppet/resource_api/base_context.rb
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,6 @@ def processing(titles, is, should, message: 'Processing')
end
end

def failed(titles, message: 'Failed')
warning("#{message}: #{titles}")
end

def attribute_changed(title, attribute, is, should, message: nil)
raise "#{__method__} only accepts a single resource title" if title.respond_to?(:each)
printable_is = 'nil'
Expand Down
6 changes: 3 additions & 3 deletions spec/puppet/resource_api/base_context_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -197,13 +197,13 @@ def send_log(l, m)
end

describe '#failed(titles, message: \'Failed\')' do
it 'logs the action at :warn level' do
expect(context).to receive(:send_log).with(:warning, %r{Failed: \[\"Thing\[one\]\", \"Thing\[two\]\"\]})
it 'logs the action at :err level' do
expect(context).to receive(:send_log).with(:err, %r{\[Thing\[one\], Thing\[two\]\].*failed})
context.failed(['Thing[one]', 'Thing[two]'])
end

it 'logs a custom message if provided' do
expect(context).to receive(:send_log).with(:warning, %r{My provider is really sorry: \[\"Thing\[one\]\", \"Thing\[two\]\"\]})
expect(context).to receive(:send_log).with(:err, %r{\[Thing\[one\], Thing\[two\]\].*My provider is really sorry})
context.failed(['Thing[one]', 'Thing[two]'], message: 'My provider is really sorry')
end
end
Expand Down

0 comments on commit 9090538

Please sign in to comment.