Age | Commit message (Collapse) | Author | Files | Lines |
|
This duplication actually bit me when writing the test for PUP-1885.
|
|
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.
|
|
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.
|
|
|
|
One test is still failing.
|
|
|
|
This also fixes the spec_helper which had a reference to
FileSystem::File
|
|
- 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
|
|
|
|
|
|
Paired-with: Andrew Parker <andy@puppetlabs.com>
|
|
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>
|
|
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>
|
|
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>
|
|
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,'
|
|
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.
|
|
Puppet::Indirector::Request#initialize had a weird implementation giving
variable semantics to positional arguments. This makes it normal again.
|
|
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.
|
|
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
|
|
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
|
|
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.
|
|
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>
|
|
These changes were superseded by existing commits in next:
lib/puppet/parser/compiler.rb
spec/unit/parser/compiler_spec.rb
|
|
Reviewed-By: Pieter van de Bruggen
|
|
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
|
|
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>
|
|
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
|
|
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
|
|
Part 2 re-did the change on the spec files, which it shouldn't have.
|
|
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
|
|
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
|