require'spec_helper'describeStorageHelperdodescribe'#storage_counter'doit'formats bytes to one decimal place'doexpect(helper.storage_counter(1.23.megabytes)).toeq'1.2 MB'endit'does not add decimals for sizes < 1 MB'doexpect(helper.storage_counter(23.5.kilobytes)).toeq'24 KB'endit'does not add decimals for zeroes'doexpect(helper.storage_counter(2.megabytes)).toeq'2 MB'endit'uses commas as thousands separator'doexpect(helper.storage_counter(100_000_000_000_000_000)).toeq'90,949.5 TB'endendend