2019-08-22 06:57:44 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2017-02-13 06:21:12 -05:00
|
|
|
require 'spec_helper'
|
|
|
|
|
2021-06-08 11:10:00 -04:00
|
|
|
RSpec.describe SystemCheck, :silence_stdout do
|
2020-05-19 11:08:04 -04:00
|
|
|
before do
|
|
|
|
stub_const('SimpleCheck', Class.new(SystemCheck::BaseCheck))
|
|
|
|
stub_const('OtherCheck', Class.new(SystemCheck::BaseCheck))
|
|
|
|
|
|
|
|
SimpleCheck.class_eval do
|
|
|
|
def check?
|
|
|
|
true
|
|
|
|
end
|
2017-05-31 14:45:00 -04:00
|
|
|
end
|
|
|
|
|
2020-05-19 11:08:04 -04:00
|
|
|
OtherCheck.class_eval do
|
|
|
|
def check?
|
|
|
|
false
|
|
|
|
end
|
2017-05-31 14:45:00 -04:00
|
|
|
end
|
2017-05-25 19:46:54 -04:00
|
|
|
end
|
|
|
|
|
2017-02-13 06:21:12 -05:00
|
|
|
describe '.run' do
|
2017-07-25 13:09:00 -04:00
|
|
|
subject { described_class }
|
2017-02-13 06:21:12 -05:00
|
|
|
|
2017-05-31 14:45:00 -04:00
|
|
|
it 'detects execution of SimpleCheck' do
|
|
|
|
is_expected.to execute_check(SimpleCheck)
|
2017-02-13 06:21:12 -05:00
|
|
|
|
2017-05-31 14:45:00 -04:00
|
|
|
subject.run('Test', [SimpleCheck])
|
|
|
|
end
|
2017-02-13 06:21:12 -05:00
|
|
|
|
2017-05-31 14:45:00 -04:00
|
|
|
it 'detects exclusion of OtherCheck in execution' do
|
|
|
|
is_expected.not_to execute_check(OtherCheck)
|
2017-02-13 06:21:12 -05:00
|
|
|
|
2017-05-31 14:45:00 -04:00
|
|
|
subject.run('Test', [SimpleCheck])
|
2017-02-13 06:21:12 -05:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|