# frozen_string_literal: true RSpec.describe PlanetExpress::ShippingOptionRepository do subject { PlanetExpress::ShippingOptionRepository.new } describe '#lowest_price_for_package_size' do it 'finds the lowest price for a package size' do expect(subject.lowest_price_for_package_size('L')).to eq(400) end end describe '#lowest_price_for_package_size' do context 'existing option' do it 'finds the correct shipping option' do result = subject.find_by_provider_and_package_size('LP', 'S') expect(result.provider).to eq('LP') expect(result.package_size).to eq('S') expect(result.price_in_cents).to eq(150) end end context 'unknown option' do it 'returns nil' do result = subject.find_by_provider_and_package_size('UNKNOWN', 'S') expect(result).to eq(nil) end end end end