Skip to content

Commit

Permalink
rubocop 1.73.0
Browse files Browse the repository at this point in the history
  • Loading branch information
toy committed Feb 26, 2025
1 parent 3e10219 commit c5a5eee
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 4 deletions.
2 changes: 1 addition & 1 deletion lib/image_optim/true_false_nil.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ def self.add_to_option_parser(option_parser)

# Convert everything truthy to `true`, leave `false` and `nil` as is
def self.convert(value)
value && true
value && true # rubocop:disable Lint/LiteralAsCondition
end
end
end
4 changes: 1 addition & 3 deletions spec/image_optim/option_definition_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,7 @@

context 'when proc given' do
subject do
# not using &:inspect due to ruby Bug #13087
# to_s is just to calm rubocop
described_class.new('abc', :def, 'desc'){ |o| o.inspect.to_s }
described_class.new('abc', :def, 'desc', &:inspect)
end

context 'when option not provided' do
Expand Down
24 changes: 24 additions & 0 deletions spec/image_optim/true_false_nil_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# frozen_string_literal: true

require 'spec_helper'
require 'image_optim/true_false_nil'

describe ImageOptim::TrueFalseNil do
describe '.convert' do
it 'keeps true' do
expect(described_class.convert(true)).to eq(true)
end

it 'keeps false' do
expect(described_class.convert(false)).to eq(false)
end

it 'keeps nil' do
expect(described_class.convert(nil)).to eq(nil)
end

it 'converts truthy to true' do
expect(described_class.convert(1)).to eq(true)
end
end
end

0 comments on commit c5a5eee

Please sign in to comment.