Commit graph

292 commits

Author SHA1 Message Date
Ashley Penney
6010e9bd93 Further fixes to tests for 14.04. 2014-06-03 14:52:10 -04:00
Ashley Penney
08f7553fb6 Fixes for PE3.3. 2014-06-03 11:11:08 -04:00
Ashley Penney
0cda858744 Merge pull request #258 from mckern/enhancement/master/camelcasedembools
(MODULES-905) Narrow the confinement in bool2str
2014-05-15 21:48:40 -04:00
Ryan McKern
557d38bdc6 (MODULES-905) Extend spec tests for bool2str
The extended spec tests validate that the common types of values
that could be passed to bool2str() are rejected.
2014-05-15 16:45:02 -07:00
Ashley Penney
c5b06f9bbc Revert "Merge pull request #256 from stbenjam/2571-before"
This reverts commit 8499ebdb7f, reversing
changes made to 08b00d9229.
2014-05-15 17:28:59 -04:00
Ashley Penney
430d821ad3 Merge pull request #255 from mckern/enhancement/master/camelcasedembools
(MODULES-905) Add bool2str() and camelcase() for string manipulation
2014-05-15 17:03:18 -04:00
Stephen Benjamin
6eaa592cd8 (PUP-2571) add 'before' functionality to file_line
file_line supports adding lines after a match, but there are use cases when
having "before" would be useful. For example, in Debian-based OS's, the last
line of /etc/rc.local is "exit 0" it's an incredible pain to deal with
that scenario today.

This commit adds a 'before' parameter to the file_line type, and implements
it for the ruby provider.
2014-05-14 20:33:57 +02:00
Ryan McKern
0761fcf043 (maint) Add bool2str & camelcase spec tests 2014-05-13 15:46:50 -07:00
Ashley Penney
14c9155745 Prepare a 4.2.1 release. 2014-05-09 16:57:32 +02:00
Hunter Haugen
0804121719 Fix the stdlib functions that fail tests 2014-05-08 14:55:23 -07:00
Hunter Haugen
96e43e69d8 Move unit tests to spec/functions
rspec-puppet matchers are defined for tests which exist in
spec/functions, but the function unit tests lived in
spec/unit/puppet/parser/functions. This moves them to the correct place
for using rspec-puppet
2014-05-08 10:47:24 -07:00
Hunter Haugen
c66a2e4f49 Add mode +x to spec .rb files 2014-05-07 15:00:30 -07:00
Hunter Haugen
78982c9238 Move the 4 misplaced tests 2014-05-07 15:00:30 -07:00
Hunter Haugen
890ef5c471 Adding more spec coverage 2014-05-07 15:00:30 -07:00
Andrea Veri
09f892023c Add the missing shebangs and fix the wrong ones for rpmlint to stop complaining loudly 2014-05-07 11:49:25 +02:00
Hunter Haugen
226cc7653c Update build_csv to understand contexts 2014-05-02 13:44:20 -07:00
Hunter Haugen
af49ef4ca2 Fix the validate_augeas beaker tests 2014-05-02 12:56:22 -07:00
Hunter Haugen
80590a9bfe Add more specs 2014-05-01 14:07:54 -07:00
Ashley Penney
f8bfe46bbf Merge pull request #243 from hunner/add_beaker
Add beaker tests for functions.
2014-04-28 14:55:29 -04:00
Ashley Penney
0b59dfe642 Merge pull request #222 from mfoo/fix/master/concat-primitives
Allow concat to take non-array second parameters
2014-04-24 13:41:42 -04:00
Ashley Penney
f42fc4bfd8 Merge pull request #238 from Spredzy/add_default_ensure_packages
(MODULES-603) Add defaults arguments to ensure_packages()
2014-04-24 13:38:07 -04:00
Ashley Penney
68acb59bf7 Adjust the regular expression for facts.
Previously this was incorrectly handling facts that were of the form
foo=1+1=2 due to the ='s in the actual fact contents.  Fix this and
add tests to try and prevent regressions.
2014-04-22 23:15:16 +02:00
Kylo Ginsberg
b691be7ea9 (maint) Remove facter versions test
This test attempts to emulate various versions of facter, but is
still dependent on the version of facter it is running against. The
immediate symptom was that the test breaks with facter 2.0.1 because
it adds another external facts search directory.

I tried a couple ways to stub this but allowing it to pretend
to run against one set of facters, while actually running against
one real facter (which might itself be one of several versions)
eluded me.

So this patch just removes the test.
2014-04-16 12:30:24 -07:00
Hunter Haugen
90222959b1 Adding more tests 2014-04-09 14:35:34 -07:00
Hunter Haugen
8a269c6722 Add build_csv 2014-04-08 16:38:33 -07:00
Hunter Haugen
f8f147e794 Add success/fail groups 2014-04-08 15:04:55 -07:00
Hunter Haugen
fcbc4b59a6 First set of tests 2014-04-03 16:58:12 -07:00
Ashley Penney
afb78e2b25 Add some acceptance tests for functions. 2014-04-03 16:58:12 -07:00
Yanis Guenane
d9b5e912bb (MODULES-603) Add defaults arguments to ensure_packages()
Without this patch one can not specify package resource specific
parameters. All the ensure_packages() function does it makes sure
the named packages are installed. This patch allows one to pass
default as a second argument and allow greater flexibility on
packages installations.

Use case like the following are now possible :
  * ensure_packages(['r10k', 'serverspec'], {'provider' => 'gem'})
  * ensure_packages(['ntp'], {'require' => 'Exec[foobar]'})
2014-03-30 18:47:36 -04:00
Ashley Penney
9a3107fed1 Add beaker framework.
This prepares the module for beaker acceptance tests.
2014-03-12 18:22:23 +00:00
Ashley Penney
e467d8f084 Merge pull request #220 from mediatemple/fix/master/deep_merge_fix
PUP-1724 Don't modify the paramaters to deep_merge
2014-03-11 09:31:23 -07:00
Ashley Penney
3854e076cc Numerous changes to update testing gems.
This work updates a number of Gems to the latest versions (rspec,
rspec-puppet), and updates and tweaks a bunch of tests to work
with the updated gems.
2014-03-08 00:42:51 +00:00
Martin Foot
35bf5fd8c9 Allow concat to take non-array second parameters
Also improve and extend concat tests to lock down functionality
2014-02-21 15:48:27 +00:00
Justin Burnham
c12e9afc97 PUP-1724 Don't modify the paramaters to deep_merge
Instead of modifying the first paramater of deep_merge due to the
use of the merge! function, instead use merge to return a copy of
the merged object. This allows one to continue to use the original
first parameter after the call to deep_merge.
2014-02-17 12:19:40 -08:00
Sharif Nassar
a972e0645b Remove trailing whitespace 2014-02-05 15:01:45 -08:00
David Schmitt
52fcef573f (PUP-638) Add a pick_default() function that always returns a value.
This version of pick() does not error out, instead always returning at least
the last argument, even if that too has no "real" value.
2014-01-29 09:26:35 -08:00
Andrew Parker
a2e9d005c7 Merge pull request #215 from blkperl/add_root_home_to_mavericks
(PUP-1459) Add support for root_home on OS X 10.9
2014-01-28 10:52:58 -08:00
Simon Effenberg
264dc9bbde (PUP-1195) Fix is_numeric/is_integer when checking non-string parameters
I expect a function called "is_numeric" or "is_integer" to check if a
variable is an integer or a number even if the variable passed by isn't
a string nor a number at all. Otherwise we should call them
is_string_a_number and is_string_an_integer and we have then to remove
the check for .is_a?(Number) and .is_a?(FixNum)

now checking also if it is a hex or octal number

improved/corrected checking for integer

* checking against Integer instead of Fixnum so that
  also Bignum is matching
* now .is_a? Integer is done first so this is quiet fast

Now many types of numerics are recognized.

1. Float/Integer values (signed or unsigned, with exponent or without)
2. octal and hex check
3. except hex numbers and the "0." in a float lower than 1 can be prefixed
   with a '0'.

whitespaces shouldn't be allowed as prefix/suffix

string representation of numbers should not contain any type of
whitespace.. the user is responsible to clean a string before checking
it..

fix documentation and added more checks

tried to be 99.9% backward compatible

* for now the decission is post poned if hex and octal numbers
  should be allowed or not (is_numeric)
* native Bignum is now also a valid integer class

fix problem with old 1.8 ruby and Hash.to_s/Array.to_s

In ruby < 1.9 array and hashes would be recognized as numeric
if they have a special format:

1.8:

  [1,2,3,4].to_s = "1234"
  {1=>2}.to_s    = "12"

1.9:

  [1,2,3,4].to_s = "[1, 2, 3, 4]"
  {1=>2}.to_s    = "{1=>2}"
2014-01-23 23:59:28 +01:00
William Van Hevelingen
fe676f0ac4 (PUP-1459) Add support for root_home on OS X 10.9
getent does not exist on 10.9 so this commit uses
dscacheutil to query the homedir for the root user.
2014-01-22 22:54:34 -08:00
Adrien Thebo
75341f01d9 (maint) Update ensure_package specs to confirm expected behavior
The previous behavior of the tests checked the behavior of the
underlying functions library when called with no arguments; this commit
updates the tests to conform to the functions API and test what happens
when a function is called with no args.
2014-01-15 11:04:03 -08:00
Tomas Doran
735db82bef Allow a single argument, rather than an array 2014-01-15 11:03:33 -08:00
Adrien Thebo
7085472e69 (maint) Improve test coverage for prefix and suffix 2013-12-20 15:03:40 -08:00
Andrew Parker
799e968f5c (Maint) Update stubbing to work with facter 1.7.4
Facter 1.7.4 changed how it decides on what directory to look in for
facts.d based on the user it is running as. This stubs out that bit of
code to make it think it is running as root.
2013-12-18 14:46:54 -08:00
Andrew Parker
1cf4b04b33 Merge pull request #211 from jhoblitt/function_is_bool
(#23381) add is_bool() function
2013-12-18 10:49:39 -08:00
Andrew Parker
210e3b7f6c Merge pull request #203 from dreamlibrarian/fix/is_function_available-ruby_c
calling rspec directly makes is_function_available.rb not pass ruby -c
2013-12-18 10:31:39 -08:00
Joshua Hoblitt
1077881873 (#23381) add is_bool() function 2013-12-09 11:50:03 -07:00
Tristan Smith
4241eb4806 calling rspec directly makes this not pass ruby -c. adjusting to be in line with the rest. 2013-11-20 18:30:46 -08:00
Tomas Doran
a1978698ef Fix the tests on osx 2013-11-19 18:42:19 +00:00
Justin Burnham
199ca9c78b (#20200) Add a recursive merge function.
Issue #20200 notes that the merge function does not
support nested hashes.

To prevent unintended side effects with changing merge,
add a deep_merge function instead.
2013-10-29 12:22:49 -07:00
Matthew Haughton
57a5c0b3e3 (Main) fix typo in pick error message
Update pick error message "at least one non empty value"
2013-10-29 12:01:25 -07:00