]> git.donarmstrong.com Git - dsa-puppet.git/blob - 3rdparty/modules/stdlib/spec/acceptance/to_bytes_spec.rb
upgrade to stdlib 4.6.1
[dsa-puppet.git] / 3rdparty / modules / stdlib / spec / acceptance / to_bytes_spec.rb
1 #! /usr/bin/env ruby -S rspec
2 require 'spec_helper_acceptance'
3
4 describe 'to_bytes function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do
5   describe 'success' do
6     it 'converts kB to B' do
7       pp = <<-EOS
8       $o = to_bytes('4 kB')
9       notice(inline_template('to_bytes is <%= @o.inspect %>'))
10       EOS
11
12       apply_manifest(pp, :catch_failures => true) do |r|
13         m = r.stdout.match(/to_bytes is (\d+)\D/)
14         expect(m[1]).to eq("4096")
15       end
16     end
17     it 'works without the B in unit'
18     it 'works without a space before unit'
19     it 'works without a unit'
20     it 'converts fractions'
21   end
22   describe 'failure' do
23     it 'handles no arguments'
24     it 'handles non integer arguments'
25     it 'handles unknown units like uB'
26   end
27 end