summaryrefslogtreecommitdiff
path: root/spec/acceptance/abs_spec.rb
blob: 0921497afe5d562b3340fc99cb3ad8f9f264c531 (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
require 'spec_helper_acceptance'

describe 'abs function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do
  it 'should accept a string' do
    pp = <<-EOS
    $input  = '-34.56'
    $output = abs($input)
    notify { $output: }
    EOS

    apply_manifest(pp, :catch_failures => true) do |r|
      expect(r.stdout).to match(/Notice: 34.56/)
    end
  end

  it 'should accept a float' do
    pp = <<-EOS
    $input  = -34.56
    $output = abs($input)
    notify { $output: }
    EOS

    apply_manifest(pp, :catch_failures => true) do |r|
      expect(r.stdout).to match(/Notice: 34.56/)
    end
  end
end