Sha256: 0a7cf2e267980de5658dfe6effb609943e9191320f49369191dc7f3bdb0bab11

Contents?: true

Size: 709 Bytes

Versions: 14

Compression:

Stored size: 709 Bytes

Contents

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

14 entries across 14 versions & 2 rubygems

Version Path
image_optim-0.26.3 spec/image_optim/option_helpers_spec.rb
image_optim-0.26.2 spec/image_optim/option_helpers_spec.rb
discourse_image_optim-0.26.2 spec/image_optim/option_helpers_spec.rb
discourse_image_optim-0.26.1 spec/image_optim/option_helpers_spec.rb
image_optim-0.26.1 spec/image_optim/option_helpers_spec.rb
image_optim-0.26.0 spec/image_optim/option_helpers_spec.rb
image_optim-0.25.0 spec/image_optim/option_helpers_spec.rb
discourse_image_optim-0.24.5 spec/image_optim/option_helpers_spec.rb
image_optim-0.24.3 spec/image_optim/option_helpers_spec.rb
discourse_image_optim-0.24.4 spec/image_optim/option_helpers_spec.rb
image_optim-0.24.2 spec/image_optim/option_helpers_spec.rb
image_optim-0.24.1 spec/image_optim/option_helpers_spec.rb
image_optim-0.24.0 spec/image_optim/option_helpers_spec.rb
image_optim-0.23.0 spec/image_optim/option_helpers_spec.rb