debian-mirror-gitlab/spec/lib/system_check_spec.rb

42 lines
798 B
Ruby
Raw Normal View History

2019-12-04 20:38:33 +05:30
# frozen_string_literal: true
2017-09-10 17:25:29 +05:30
require 'spec_helper'
require 'rake_helper'
2020-07-28 23:09:34 +05:30
RSpec.describe SystemCheck do
2020-05-24 23:13:21 +05:30
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-09-10 17:25:29 +05:30
end
2020-05-24 23:13:21 +05:30
OtherCheck.class_eval do
def check?
false
end
2017-09-10 17:25:29 +05:30
end
silence_output
end
describe '.run' do
subject { described_class }
it 'detects execution of SimpleCheck' do
is_expected.to execute_check(SimpleCheck)
subject.run('Test', [SimpleCheck])
end
it 'detects exclusion of OtherCheck in execution' do
is_expected.not_to execute_check(OtherCheck)
subject.run('Test', [SimpleCheck])
end
end
end