inspec/test/unit/rspec_json_formatter_test.rb
Jared Quick 0dc0e3b457 Update rspec cli control summary to not uniq fails. (#2362)
Signed-off-by: Jared Quick <jquick@chef.io>
2017-12-05 13:07:31 +01:00

31 lines
962 B
Ruby

# encoding: utf-8
# copyright: 2017, Chef Software Inc.
require 'helper'
require 'inspec/objects'
describe 'rspec_json_formatter' do
describe 'InspecRspecCli::Control' do
# have to require here else it messes with minitest
require 'inspec/rspec_json_formatter'
let(:control) do
control = { results: [], title: 'test' }
InspecRspecCli::Control.new(control, nil)
end
it 'summary must count unique fails/skips' do
control.expects(:summary_calculation_needed?).returns(false)
control.stubs(:fails).returns([1, 1])
control.stubs(:skips).returns([1, 1])
control.summary.must_equal 'test (2 failed 2 skipped)'
end
it 'summary must count different fails/skips' do
control.expects(:summary_calculation_needed?).returns(false)
control.stubs(:fails).returns([1, 2])
control.stubs(:skips).returns([1, 2])
control.summary.must_equal 'test (2 failed 2 skipped)'
end
end
end