Sha256: de234c4b4cd5180ed600066c5a0169d198d36afa96b113baa0a9ebc10f94a254
Contents?: true
Size: 1.09 KB
Versions: 4
Compression:
Stored size: 1.09 KB
Contents
require 'spec_helper' describe IEX::Resources::Base do context 'float number to percent (Positive)' do subject do IEX::Resources::Base.float_to_percentage(0.09123) end it 'converts to percentage' do expect(subject).to eq '+9.12%' end end context 'float number to percent (Negative)' do subject do IEX::Resources::Base.float_to_percentage(-0.09123) end it 'converts to percentage' do expect(subject).to eq '-9.12%' end end context 'float number to percent (nil)' do subject do IEX::Resources::Base.float_to_percentage(nil) end it 'nil argument does not convert' do expect(subject).to eq nil end end context 'float number to percent (0)' do subject do IEX::Resources::Base.float_to_percentage(0) end it 'Zero converts to +0.00%' do expect(subject).to eq '+0.00%' end end context 'Unformatted money amount to dollar' do subject do IEX::Resources::Base.to_dollar(amount: 123_391) end it 'converts to dollar' do expect(subject).to eq '$123,391' end end end
Version data entries
4 entries across 4 versions & 1 rubygems