Sha256: 403bd9e047f077042d86faf7083ae5a9624996b26f53e553ade10b0ed58ce932

Contents?: true

Size: 645 Bytes

Versions: 5

Compression:

Stored size: 645 Bytes

Contents

require 'guerrilla_patch/aggregate_by_type/divide_by_type'

describe DivideByType do
  before(:each) do
    @ratios = { '1A' => 50, '1B' => 30, '1C' => 20 }
  end

  it 'knows ratios' do
    DivideByType.divide(@ratios, 50).should ==
      {'1A' => 25, '1B' => 15, '1C' => 10}
  end

  it 'knows ratios for negative values' do
    DivideByType.divide(@ratios, -50).should ==
      {'1A' => -25, '1B' => -15, '1C' => -10}
  end

  it 'returns empty dividis for zero' do
    DivideByType.divide(@ratios, 0).should == {}
  end

  it 'knows how to divide without ratios' do
    DivideByType.divide({}, 10).should == { :no_division => 10}
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
guerrilla_patch-2.8.2 spec/guerrilla_patch/aggregate_by_type/divide_by_type_spec.rb
guerrilla_patch-2.8.1 spec/guerrilla_patch/aggregate_by_type/divide_by_type_spec.rb
guerrilla_patch-2.8.0 spec/guerrilla_patch/aggregate_by_type/divide_by_type_spec.rb
guerrilla_patch-2.7.1 spec/guerrilla_patch/aggregate_by_type/divide_by_type_spec.rb
guerrilla_patch-2.7.0 spec/guerrilla_patch/aggregate_by_type/divide_by_type_spec.rb