Sha256: 6c206a025b3ecde3ac7093f218b1e9bd6cc451e8f4a041714eec726c8aa13b5c

Contents?: true

Size: 740 Bytes

Versions: 12

Compression:

Stored size: 740 Bytes

Contents

# frozen_string_literal: true

require 'spec_helper'
require 'image_optim/option_helpers'

describe ImageOptim::OptionHelpers do
  describe '.limit_with_range' do
    {
      2..4 => 'inclusive',
      2...5 => 'exclusive',
    }.each do |range, type|
      context "for an end #{type} range" do
        it 'returns number when it is in range' do
          expect(described_class.limit_with_range(4, range)).to eq(4)
        end

        it 'returns begin when it is less than minimum' do
          expect(described_class.limit_with_range(1, range)).to eq(2)
        end

        it 'returns end when it is more than maximum' do
          expect(described_class.limit_with_range(10, range)).to eq(4)
        end
      end
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
image_optim-0.31.4 spec/image_optim/option_helpers_spec.rb
image_optim-0.31.3 spec/image_optim/option_helpers_spec.rb
image_optim-0.31.2 spec/image_optim/option_helpers_spec.rb
image_optim-0.31.1 spec/image_optim/option_helpers_spec.rb
image_optim-0.31.0 spec/image_optim/option_helpers_spec.rb
image_optim-0.30.0 spec/image_optim/option_helpers_spec.rb
image_optim-0.29.0 spec/image_optim/option_helpers_spec.rb
image_optim-0.28.0 spec/image_optim/option_helpers_spec.rb
image_optim-0.27.1 spec/image_optim/option_helpers_spec.rb
image_optim-0.27.0 spec/image_optim/option_helpers_spec.rb
image_optim-0.26.5 spec/image_optim/option_helpers_spec.rb
image_optim-0.26.4 spec/image_optim/option_helpers_spec.rb