X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;ds=sidebyside;f=3rdparty%2Fmodules%2Fstdlib%2Fspec%2Facceptance%2Fto_bytes_spec.rb;fp=3rdparty%2Fmodules%2Fstdlib%2Fspec%2Facceptance%2Fto_bytes_spec.rb;h=2b4c61f48db6ae25d6f05423a6f07cf4bca89622;hb=ad88f67c13ae0f1a08936dad643f1e3509ab5f40;hp=0000000000000000000000000000000000000000;hpb=23d29143ac40015ce61cf83a4067466f8f7d66dc;p=dsa-puppet.git diff --git a/3rdparty/modules/stdlib/spec/acceptance/to_bytes_spec.rb b/3rdparty/modules/stdlib/spec/acceptance/to_bytes_spec.rb new file mode 100755 index 00000000..2b4c61f4 --- /dev/null +++ b/3rdparty/modules/stdlib/spec/acceptance/to_bytes_spec.rb @@ -0,0 +1,27 @@ +#! /usr/bin/env ruby -S rspec +require 'spec_helper_acceptance' + +describe 'to_bytes function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do + describe 'success' do + it 'converts kB to B' do + pp = <<-EOS + $o = to_bytes('4 kB') + notice(inline_template('to_bytes is <%= @o.inspect %>')) + EOS + + apply_manifest(pp, :catch_failures => true) do |r| + m = r.stdout.match(/to_bytes is (\d+)\D/) + expect(m[1]).to eq("4096") + end + end + it 'works without the B in unit' + it 'works without a space before unit' + it 'works without a unit' + it 'converts fractions' + end + describe 'failure' do + it 'handles no arguments' + it 'handles non integer arguments' + it 'handles unknown units like uB' + end +end