forked from puppetlabs/puppetlabs-stdlib
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathabs_spec.rb
More file actions
executable file
·30 lines (26 loc) · 733 Bytes
/
abs_spec.rb
File metadata and controls
executable file
·30 lines (26 loc) · 733 Bytes
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
28
29
30
#! /usr/bin/env ruby -S rspec
require 'spec_helper_acceptance'
describe 'abs function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do
describe 'success' 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
end