Sha256: f44d773d3db03c31c7ca199a1810f2bf5a28e7a863a73bd44fa465dbba04eda1

Contents?: true

Size: 841 Bytes

Versions: 9

Compression:

Stored size: 841 Bytes

Contents

require 'rails_helper'

module Logistics
  module Core
    RSpec.describe UnitService do
      describe '#convert_unit' do
        it 'converts to quintal' do
          create(:unit, abbreviation: 'qt', name: 'Quintal', rate_to_base: 1)
          create(:unit, abbreviation: 'kg', name: 'Kilogram', rate_to_base: 5)
          unit_service = UnitService.new
          converted = unit_service.convert_unit(20, 'kg')
          expect(converted).to eq 4
        end

        it 'converts from quintal' do
          create(:unit, abbreviation: 'qt', name: 'Quintal', rate_to_base: 1)
          create(:unit, abbreviation: 'kg', name: 'Kilogram', rate_to_base: 5)
          unit_service = UnitService.new
          converted = unit_service.convert_unit(6, 'kg', false)
          expect(converted).to eq 30
        end
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
logistics_core-21.11.2 spec/services/logistics/core/unit_service_spec.rb
logistics_core-21.11.1 spec/services/logistics/core/unit_service_spec.rb
logistics_core-21.08.1 spec/services/logistics/core/unit_service_spec.rb
logistics_core-21.03.1 spec/services/logistics/core/unit_service_spec.rb
logistics_core-20.10.3 spec/services/logistics/core/unit_service_spec.rb
logistics_core-20.10.2 spec/services/logistics/core/unit_service_spec.rb
logistics_core-20.10.1 spec/services/logistics/core/unit_service_spec.rb
logistics_core-20.9.1 spec/services/logistics/core/unit_service_spec.rb
logistics_core-20.8.1 spec/services/logistics/core/unit_service_spec.rb