Sha256: 4897aa48fd51c2b9612067df409b1cde0a6b4bc42ec6727f66d88ea794ef6e9b

Contents?: true

Size: 841 Bytes

Versions: 15

Compression:

Stored size: 841 Bytes

Contents

require 'spec_helper'
require 'tronprint/statistics_formatter'
require 'action_view'

class StatisticsFormatterHarness
  include ActionView::Helpers
  include Tronprint::StatisticsFormatter
end

describe Tronprint::StatisticsFormatter do
  let(:formatter) { StatisticsFormatterHarness.new }

  describe '#pounds_with_precision' do
    it 'converts kilograms to pounds' do
      formatter.pounds_with_precision(1).should == '2.2046'
    end
    it 'uses a precision of 4 if the number is less than 100' do
      formatter.pounds_with_precision(8).should == '17.6368'
    end
    it 'uses a precision of 4 if the number is 0' do
      formatter.pounds_with_precision(0).should == '0.0000'
    end
    it 'uses a precision of 0 if the number is at least 100' do
      formatter.pounds_with_precision(60).should == '132.2760'
    end
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
tronprint-1.2.3 spec/tronprint/statistics_formatter_spec.rb
tronprint-1.2.2 spec/tronprint/statistics_formatter_spec.rb
tronprint-1.2.1 spec/tronprint/statistics_formatter_spec.rb
tronprint-1.2.0 spec/tronprint/statistics_formatter_spec.rb
tronprint-1.1.5 spec/tronprint/statistics_formatter_spec.rb
tronprint-1.1.4 spec/tronprint/statistics_formatter_spec.rb
tronprint-1.1.3 spec/tronprint/statistics_formatter_spec.rb
tronprint-1.1.2 spec/tronprint/statistics_formatter_spec.rb
tronprint-1.1.1 spec/tronprint/statistics_formatter_spec.rb
tronprint-1.1.0 spec/tronprint/statistics_formatter_spec.rb
tronprint-1.0.5 spec/tronprint/statistics_formatter_spec.rb
tronprint-1.0.4 spec/tronprint/statistics_formatter_spec.rb
tronprint-1.0.2 spec/tronprint/statistics_formatter_spec.rb
tronprint-1.0.1 spec/tronprint/statistics_formatter_spec.rb
tronprint-1.0.0 spec/tronprint/statistics_formatter_spec.rb