2022-11-19 21:46:58 -08:00
|
|
|
# typed: false
|
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
require "rubocops/platform"
|
|
|
|
|
|
|
|
describe RuboCop::Cop::Homebrew::MoveToExtendOS do
|
|
|
|
subject(:cop) { described_class.new }
|
|
|
|
|
|
|
|
it "registers an offense when using `OS.linux?`" do
|
|
|
|
expect_offense(<<~RUBY)
|
|
|
|
OS.linux?
|
2022-11-21 22:14:04 -08:00
|
|
|
^^^^^^^^^ Move `OS.linux?` and `OS.mac?` calls to `extend/os`.
|
2022-11-19 21:46:58 -08:00
|
|
|
RUBY
|
|
|
|
end
|
|
|
|
|
|
|
|
it "registers an offense when using `OS.mac?`" do
|
|
|
|
expect_offense(<<~RUBY)
|
|
|
|
OS.mac?
|
2022-11-21 22:14:04 -08:00
|
|
|
^^^^^^^ Move `OS.linux?` and `OS.mac?` calls to `extend/os`.
|
2022-11-19 21:46:58 -08:00
|
|
|
RUBY
|
|
|
|
end
|
|
|
|
end
|