summaryrefslogtreecommitdiff
path: root/spec/acceptance/to_bytes_spec.rb
blob: b1015a3932dba9d4032513630853d7f8fd50ce91 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#! /usr/bin/env ruby -S rspec
require 'spec_helper_acceptance'

describe 'to_bytes function' 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