Sha256: 69822f5377856504ede674a19519d537e9ca3ed2d3f8597fe11fa6d7f4c92bff
Contents?: true
Size: 1.91 KB
Versions: 3
Compression:
Stored size: 1.91 KB
Contents
require 'spec_helper' describe Phare::CheckSuite do let(:described_class) { Phare::CheckSuite } describe :run do let(:options) { { directory: '.' } } let(:suite) { described_class.new(options) } before do Phare::CheckSuite::DEFAULT_CHECKS.values.each_with_index do |check, index| exit_status = exit_status_proc.call(index) allow_any_instance_of(check).to receive(:run) allow_any_instance_of(check).to receive(:status).and_return(exit_status) end end context 'with a single failing check' do let(:exit_status_proc) do proc { |index| index == 2 ? 1337 : 0 } end it { expect { suite.run }.to change { suite.status }.to(1337) } end context 'with a multiple failing checks' do let(:exit_status_proc) do proc { |index| (index * 500) + 20 } end it { expect { suite.run }.to change { suite.status }.to(20) } end context 'with no failing check' do let(:exit_status_proc) { proc { 0 } } it { expect { suite.run }.to change { suite.status }.to(0) } end end describe :checks do let(:options) { { directory: '.', skip: skip, only: only } } let(:suite) { described_class.new(options) } let(:skip) { [] } let(:only) { [] } context 'with "only" option' do let(:only) { [:rubocop, :foo, :jshint] } it { expect(suite.checks).to eql [:rubocop, :jshint] } end context 'with "skip" option' do let(:skip) { [:scsslint, :foo, :jshint] } it { expect(suite.checks).to eql [:rubocop, :jscs] } end context 'with both "only" and "skip" option' do let(:skip) { [:scsslint, :rubocop] } let(:only) { [:scsslint, :foo, :jshint] } it { expect(suite.checks).to eql [:scsslint, :jshint] } end context 'with both "only" and "skip" option' do it { expect(suite.checks).to eql Phare::CheckSuite::DEFAULT_CHECKS.keys } end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
phare-0.7.1 | spec/phare/check_suite_spec.rb |
phare-0.7 | spec/phare/check_suite_spec.rb |
phare-0.6 | spec/phare/check_suite_spec.rb |