127 lines
3.4 KiB
Ruby
Raw Permalink Normal View History

# frozen_string_literal: true
require "rubocops/rubocop-cask"
RSpec.describe RuboCop::Cop::Cask::Desc, :config do
it "does not start with an article" do
expect_no_offenses <<~RUBY
cask "foo" do
desc "Bar program"
end
RUBY
expect_offense <<~RUBY, "/homebrew-cask/Casks/foo.rb"
cask 'foo' do
desc 'A bar program'
2023-05-08 11:02:44 +02:00
^ Description shouldn't start with an article.
end
RUBY
expect_offense <<~RUBY, "/homebrew-cask/Casks/foo.rb"
cask 'foo' do
desc 'The bar program'
2023-05-08 11:02:44 +02:00
^^^ Description shouldn't start with an article.
end
RUBY
expect_correction <<~RUBY
cask 'foo' do
desc 'Bar program'
end
RUBY
end
it "does not start with the cask name" do
expect_offense <<~RUBY, "/homebrew-cask/Casks/foo.rb"
cask 'foobar' do
desc 'Foo bar program'
2023-05-08 11:02:44 +02:00
^^^^^^^ Description shouldn't start with the cask name.
end
RUBY
expect_offense <<~RUBY, "/homebrew-cask/Casks/foo.rb"
cask 'foobar' do
desc 'Foo-Bar program'
2023-05-08 11:02:44 +02:00
^^^^^^^ Description shouldn't start with the cask name.
end
RUBY
expect_offense <<~RUBY, "/homebrew-cask/Casks/foo.rb"
cask 'foo-bar' do
desc 'Foo bar program'
2023-05-08 11:02:44 +02:00
^^^^^^^ Description shouldn't start with the cask name.
end
RUBY
expect_offense <<~RUBY, "/homebrew-cask/Casks/foo.rb"
cask 'foo-bar' do
desc 'Foo-Bar program'
2023-05-08 11:02:44 +02:00
^^^^^^^ Description shouldn't start with the cask name.
end
RUBY
expect_offense <<~RUBY, "/homebrew-cask/Casks/foo.rb"
cask 'foo-bar' do
desc 'Foo Bar'
2023-05-08 11:02:44 +02:00
^^^^^^^ Description shouldn't start with the cask name.
end
RUBY
end
it "does not contain the platform" do
expect_offense <<~RUBY, "/homebrew-cask/Casks/foo.rb"
cask 'foo-bar' do
desc 'macOS status bar monitor'
2023-05-08 11:02:44 +02:00
^^^^^ Description shouldn't contain the platform.
end
RUBY
expect_offense <<~RUBY, "/homebrew-cask/Casks/foo.rb"
cask 'foo-bar' do
desc 'Toggles dark mode on Mac OS Mojave'
2023-05-08 11:02:44 +02:00
^^^^^^ Description shouldn't contain the platform.
end
RUBY
expect_offense <<~RUBY, "/homebrew-cask/Casks/foo.rb"
cask 'foo-bar' do
desc 'Better input source switcher for OS X'
2023-05-08 11:02:44 +02:00
^^^^ Description shouldn't contain the platform.
end
RUBY
expect_offense <<~RUBY, "/homebrew-cask/Casks/foo.rb"
cask 'foo-bar' do
desc 'Media Manager for Mac OS X'
2023-05-08 11:02:44 +02:00
^^^^^^^^ Description shouldn't contain the platform.
end
RUBY
expect_no_offenses <<~RUBY
cask 'foo' do
desc 'Application for managing macOS virtual machines'
end
RUBY
expect_offense <<~RUBY
cask 'foo' do
desc 'Application for managing macOS virtual machines on macOS'
2023-05-08 11:02:44 +02:00
^^^^^ Description shouldn't contain the platform.
end
RUBY
2023-06-20 08:10:30 -04:00
expect_offense <<~RUBY
cask 'foo' do
desc 'Description with a 🍺 symbol'
2023-06-20 11:33:49 -04:00
^ Description shouldn't contain Unicode emojis or symbols.
2023-06-20 08:10:30 -04:00
end
RUBY
expect_no_offenses <<~RUBY
cask 'foo' do
desc 'MAC address changer'
end
RUBY
end
end