summaryrefslogtreecommitdiff
path: root/spec/unit/file_serving/fileset_spec.rb
AgeCommit message (Collapse)AuthorFilesLines
2014-03-07(Maint) Remove some duplication in testsAndrew Parker1-5/+8
This duplication actually bit me when writing the test for PUP-1885.
2014-03-07(PUP-1885) Stringify ignores for file servingAndrew Parker1-2/+16
Commit 6353ebbbc0d3804e30e9961559b01c9a69a74a93 introduced non-yaml encoding for arrays of HTTP parameters. Unfortunately this also exposed those values to the type conversion that is done to parameters in the HTTP layer, which caused an ignore for a file matching "0" to be turned into the number 0. The file serving code didn't handle getting non-string ignore patterns and would then raise an error. This changes the file server to stringify all of the parameters that it recieves for ignores, which solves both the number problem as well as a related one for booleans. An alternative solution to this would have been to change the HTTP handler so that it didn't try to convert arrays of values. I didn't go for that because it would have caused the parameter handling to be inconsistent.
2014-01-06(PUP-716) Change back to stubs from mocksAndrew Parker1-1/+1
During changes a few calls had been inadvertently changed from stubs (any number of calls allowed, including 0) to mocks (at least one call required). In the case of the file_set this caused a problem for when there was no expectaiton of the methods being called. In the daemontools case, this exposed a mistake that was originally in the tests where the stub was not even needed.
2014-01-06(PUP-716) Remove references to FileSystem::File in non codeHenrik Lindberg1-2/+2
2014-01-06(PUP-716) Fix up fileset_spec (1 failing test remains)Henrik Lindberg1-18/+7
One test is still failing.
2014-01-06(PUP-716) Make more tests in fileset_spec passHenrik Lindberg1-3/+3
2014-01-06(PUP-716) Change more tests after refactoringHenrik Lindberg1-33/+23
This also fixes the spec_helper which had a reference to FileSystem::File
2013-11-08(#19447) Puppet::FileSystem::File#stat / lstatEthan J. Brown1-27/+57
- All calls to File class stat / lstat go through the new FileSystem::File abstraction so that the implementation can later be swapped for a Windows specific one to support symlinks
2013-04-26(#20308) Try again to fix fileset tests on WindowsPatrick Carlisle1-1/+1
2013-04-26(#20308) Fix fileset spec for WindowsPatrick Carlisle1-1/+1
2013-04-25(#20308) Clean up the fileset specsPatrick Carlisle1-261/+243
Paired-with: Andrew Parker <andy@puppetlabs.com>
2013-04-25(#20308) Refactor fileset recursion for clarityPatrick Carlisle1-19/+18
The previous expression of the algorithm for traversing the file structure and producing the available files was hard to understand and therefore error prone (see the bug that is being fixed here). This refactors it to be better separated and should be easier to see any problems in it. Another part of the cleanup was to make checks against the filesystem more explicit: either the path is valid or not, whether the path is a directory. Paired-with: Andrew Parker <andy@puppetlabs.com>
2013-04-25(#20308) Make more of Fileset privatePatrick Carlisle1-68/+0
Several of the public methods on fileset only seemed to be there for testing. There is no need for this as the behavior of the file listing already checks the conditions controlled by those internal methods. Paired-with: Andrew Parker <andy@puppetlabs.com>
2013-04-25(#20308) Add failing test for incomplete file listPatrick Carlisle1-0/+37
Under certain circumstances the fileset will drop subdirectories from its results. This adds a test showing this failure. Paired-with: Andrew Parker <andy@puppetlabs.com>
2012-09-26(Maint) Remove rspec from shebang lineJeff McCune1-1/+1
Without this patch Ruby 1.9 is still complaining loudly about trying to parse the spec files. The previous attempt to clean up this problem in edc3ddf works for Ruby 1.8 but not 1.9. I'd prefer to remove the shebang lines entirely, but doing so will cause encoding errors in Ruby 1.9. This patch strives for a happy middle ground of convincing Ruby it is actually working with Ruby while not confusing it to think it should exec() to rspec. This patch is the result of the following command run against the source tree: find spec -type f -print0 | \ xargs -0 perl -pl -i -e 's,^\#\!\s?/(.*)rspec,\#! /usr/bin/env ruby,'
2012-07-02(maint) Standardize on /usr/bin/env ruby -S rspecJeff McCune1-1/+1
Without this patch some spec files are using `ruby -S rspec` and others are using `rspec`. We should standardize on a single form of the interpreter used for spec files. `ruby -S rspec` is the best choice because it correctly informs editors such as Vim with Syntastic that the file is a Ruby file rather than an Rspec file.
2012-04-23Make positional arguments distinct in Request#initializePatrick Carlisle1-12/+12
Puppet::Indirector::Request#initialize had a weird implementation giving variable semantics to positional arguments. This makes it normal again.
2011-09-27Simplify absolute path detectionJosh Cooper1-1/+1
Previously, we were trying to detect absolute-path-ness if File.expand_path == path, but we now have a method for checking absolute pathness, so we use that.
2011-08-19Fix tests with "relative" paths on WindowsJosh Cooper1-55/+71
Absolute paths on Unix, e.g. /foo/bar, are not absolute on Windows, which breaks many test cases. This commit adds a method to PuppetSpec::Files.make_absolute that makes the path absolute in test cases. On Unix (Puppet.features.posix?) it is a no-op. On Windows, (Puppet.features.microsoft_windows?) the drive from the current working directory is prepended. Reviewed-by: Jacob Helwig <jacob@puppetlabs.com> (cherry picked from commit 462a95e3d077b1915a919399b846068816c84583) Conflicts: spec/unit/parser/functions/extlookup_spec.rb
2011-05-03(#7139) Accept '/' as a valid path in filesetsNick Lewis1-0/+7
This was unconditionally removing the trailing file separator ('/'), which is only valid when the file separator isn't the entire path. This fixes 'puppet resource file <path>'. Paired-With: Jacob Helwig
2011-04-13maint: clean up the spec test headers in bulk.Daniel Pittman1-2/+1
We now use a shebang of: #!/usr/bin/env rspec This enables the direct execution of spec tests again, which was lost earlier during the transition to more directly using the rspec2 runtime environment.
2011-04-08maint: just require 'spec_helper', thanks rspec2Daniel Pittman1-1/+1
rspec2 automatically sets a bunch of load-path stuff we were by hand, so we can just stop. As a side-effect we can now avoid a whole pile of stupid things to try and include the spec_helper.rb file... ...and then we can stop protecting spec_helper from evaluating twice, since we now require it with a consistent name. Yay. Reviewed-By: Pieter van de Bruggen <pieter@puppetlabs.com>
2011-03-25Merge commit '2.6.next^1' into nextJesse Wolfe1-0/+8
These changes were superseded by existing commits in next: lib/puppet/parser/compiler.rb spec/unit/parser/compiler_spec.rb
2011-03-24(#5221) Add test for fix to fileset with trailing separatorNick Lewis1-0/+8
Reviewed-By: Pieter van de Bruggen
2010-12-16Merge branch '2.6.x' into nextNick Lewis1-0/+1
Manually Resolved Conflicts: lib/puppet/resource/type_collection.rb spec/unit/configurer_spec.rb spec/unit/indirector/catalog/active_record_spec.rb spec/unit/resource/type_collection_spec.rb spec/unit/transaction/resource_harness_spec.rb
2010-12-10maint: missing stubJesse Wolfe1-0/+1
This missing stub was raising an exception that, in versions of Mocha less than 0.9.10, was coincidentally causing the method under test to behave as expected. Paired-With: Nick Lewis <nick@puppetlabs.com>
2010-12-06maint: Use expand_path when requiring spec_helper or puppettestMatt Robinson1-1/+1
Doing a require to a relative path can cause files to be required more than once when they're required from different relative paths. If you expand the path fully, this won't happen. Ruby 1.9 also requires that you use expand_path when doing these requires. Paired-with: Jesse Wolfe
2010-07-09Code smell: Two space indentationMarkus Roberts1-314/+314
Replaced 106806 occurances of ^( +)(.*$) with The ruby community almost universally (i.e. everyone but Luke, Markus, and the other eleven people who learned ruby in the 1900s) uses two-space indentation. 3 Examples: The code: end # Tell getopt which arguments are valid def test_get_getopt_args element = Setting.new :name => "foo", :desc => "anything", :settings => Puppet::Util::Settings.new assert_equal([["--foo", GetoptLong::REQUIRED_ARGUMENT]], element.getopt_args, "Did not produce appropriate getopt args") becomes: end # Tell getopt which arguments are valid def test_get_getopt_args element = Setting.new :name => "foo", :desc => "anything", :settings => Puppet::Util::Settings.new assert_equal([["--foo", GetoptLong::REQUIRED_ARGUMENT]], element.getopt_args, "Did not produce appropriate getopt args") The code: assert_equal(str, val) assert_instance_of(Float, result) end # Now test it with a passed object becomes: assert_equal(str, val) assert_instance_of(Float, result) end # Now test it with a passed object The code: end assert_nothing_raised do klass[:Yay] = "boo" klass["Cool"] = :yayness end becomes: end assert_nothing_raised do klass[:Yay] = "boo" klass["Cool"] = :yayness end
2010-06-28[#3994-part 3] rename spec tests from *_spec_spec to *_spec.rbMarkus Roberts1-0/+347
Part 2 re-did the change on the spec files, which it shouldn't have.
2010-06-28[#3994-part 2] rename integration tests to *_spec.rbMarkus Roberts1-347/+0
Some spec files like active_record.rb had names that would confuse the load path and get loaded instead of the intended implentation when the spec was run from the same directory as the file. Author: Matt Robinson <matt@puppetlabs.com> Date: Fri Jun 11 15:29:33 2010 -0700
2010-06-23[#3994] rename the specs to have _spec.rb at the endMarkus Roberts1-0/+347
Some spec files like active_record.rb had names that would confuse the load path and get loaded instead of the intended implentation when the spec was run from the same directory as the file. Author: Matt Robinson <matt@puppetlabs.com> Date: Fri Jun 11 15:29:33 2010 -0700