summaryrefslogtreecommitdiff
path: root/spec/shared_behaviours
AgeCommit message (Collapse)AuthorFilesLines
2014-07-15(maint) Remove deprecated `.to_not raise_error(args)` callsAdrien Thebo1-1/+1
From RSpec: DEPRECATION: `expect { }.not_to raise_error(SpecificErrorClass, message)` is deprecated. Use `expect { }.not_to raise_error` (with no args) instead. This commit removes all args from `.to_not raise_error` expectations.
2014-07-02(maint) Move the interative functions shared behavior to common dirHenrik Lindberg1-0/+69
This commit moves the shared behavior for iterative functions to shared_behaviours/iterative_functions.
2014-05-28(PUP-1843) Clean up hiera terminusJosh Partlow1-0/+4
The data_binding/hiera_spec.rb had a specific after block to clear up the hiera terminus for following tests. Moved this to the shared_behaviors/hiera_indirections so that both indirector/hiera_spec and data_binding/hiera_spec would be cleaned up, preventing order dependent errors caused by global terminus state leaking between tests.
2014-05-28(PUP-1843) Refactor duplicate codeJosh Partlow1-0/+95
Puppet::Indirector::Hiera and Puppet::DataBinding::Hiera had identical implementations. Puppet::DataBinding::Hiera is now a subclass of Puppet::Indirector::Hiera. Common behavior in their specs was also moved into spec/shared_behaviors.
2014-01-06(PUP-716) Change Puppet::FileSystem::File to module methodsHenrik Lindberg1-2/+2
This changes the API in a new implementation in a file called file_.rb The intent is that it should replace the implemntation in File, or perhaps directly in a Puppet::FileSystem class.
2013-11-08(#19447) Puppet::FileSystem::File.exist?Ethan J. Brown1-2/+2
- All previous File and FileTest calls to exist? or exists? go through the new FileSystem::File abstraction so that the implementation can later be swapped for a Windows specific one to support symlinks
2013-10-03(maint) Instead of two indent-stripping methods, let's have oneNick Fagerlund1-3/+3
This was unDRY, AND the methods had differing behavior. (The faces one didn't make exceptions for first-line underhang, which demanded unintuitive source formatting.) This commit just replaces the implementation of the faces scrubber with a scrub() call. Spec test change: This method trims trailing newlines from strings.
2012-09-26(Maint) Remove rspec from shebang lineJeff McCune3-3/+3
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-24Merge branch '2.7.x' into 3.xPatrick Carlisle2-10/+10
* 2.7.x: Use rspec 2.11 compatible block syntax Conflicts: spec/integration/faces/ca_spec.rb spec/integration/network/server/mongrel_spec.rb spec/unit/application_spec.rb spec/unit/face/help_spec.rb spec/unit/network/handler/fileserver_spec.rb spec/unit/parser/functions/create_resources_spec.rb spec/unit/provider/nameservice/directoryservice_spec.rb spec/unit/type/file_spec.rb spec/unit/type_spec.rb
2012-07-23Use rspec 2.11 compatible block syntaxPatrick Carlisle2-10/+10
In rspec 2.11, expectations on a block must take the form of expect...to or lambda...should. Other combinations of those are no longer accepted. This commit converts all mixed cases to use expect...to, as it seems to be the preferred syntax now.
2012-07-12Merge branch '2.7.x' into 3.0rcPatrick Carlisle2-45/+138
* 2.7.x: (26 commits) Extract host validation in store report processor Use cross-platform absolute paths in file_serving tests (#15221) Create /etc/puppet/modules directory for puppet module tool (Maint:) Fix bad doc strings for two settings ("wether") Try again to avoid circular dependency in file indirections Remove useless tests for Envelope Clear deprecation warnings between tests Avoid circular requirement in FileMetadata indirection (Maint) Document common Windows issues Update CHANGELOG lib/puppet.rb conf/redhat/puppet.spec for 2.7.18 Maint: Note in docs that the file type's "replace" attribute defaults to true Reject directory traversal in store report processor Tighten permissions on classfile, resourcefile, lastrunfile, and lastrunreport. Use "inspect" when listing certificates Don't allow the creation of SSL objects with invalid certnames Validate CSR CN and provided certname before signing Add specs for selector terminuses of file_{content,metadata} Fix whitespace inside parentheses Use head method to determine if file is in file bucket Always use the local file_bucket on master ... Conflicts: CHANGELOG conf/redhat/puppet.spec lib/puppet.rb lib/puppet/application/master.rb lib/puppet/defaults.rb lib/puppet/file_serving/terminus_selector.rb lib/puppet/reports/store.rb lib/puppet/test/test_helper.rb spec/integration/file_serving/content_spec.rb spec/integration/file_serving/metadata_spec.rb spec/shared_behaviours/file_serving.rb spec/unit/file_serving/terminus_selector_spec.rb spec/unit/network/handler/ca_spec.rb test/ral/manager/attributes.rb
2012-07-12Use cross-platform absolute paths in file_serving testsPatrick Carlisle1-6/+9
The file_serving tests were failing on windows because they used unix style paths. This makes them absolute on both posix and windows.
2012-07-02(maint) Standardize on /usr/bin/env ruby -S rspecJeff McCune2-2/+2
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-06-26Add specs for selector terminuses of file_{content,metadata}Nick Lewis2-56/+143
2012-06-26Add Selector terminus for file_content/file_metadataPatrick Carlisle1-3/+1
This terminus is now the default, and encapsulates the behavior that was previously in the IndirectionHooks. That is, we dynamically select the terminus to use for a file request based on the key. However, for the puppet master, we instead explicitly always use the FileServer terminus, so that *all* requests for files from the master will go through the file server. This ensures that we will never accidentally serve local files on the puppet master.
2012-04-26Add default_file_terminus settingPatrick Carlisle1-23/+5
This setting is used to determine the default source of files accessed with a puppet: url and no server specified, e.g. puppet:///path/to/file. Before now, this was done by checking if Puppet[:name] was `apply`. Since Puppet[:name] is removed and we don't want application specific logic spread throughout the code, we are adding a setting specific to this particular behavior. The `apply` application sets a default value of `file_terminus`, which retains the previous behavior of `apply`. Otherwise the default value is `rest`, causing Puppet[:server] to be used to retrieve the file.
2012-04-23Make positional arguments distinct in Request#initializePatrick Carlisle1-1/+1
Puppet::Indirector::Request#initialize had a weird implementation giving variable semantics to positional arguments. This makes it normal again.
2012-04-10Merge branch '2.7.x'Patrick Carlisle1-29/+2
* 2.7.x: (maint) Remove unnecessary step from puppet module build help (#13659) Convert fact values to string when searching database (#13649) Restrict module name matching (#13643) Make the use of FileUtils.rm_rf secure (#13642) Move search notice message (#13639) Don't send errors directly to stderr (#13638) Add SemVer#pre function (#3581) Stop forking around: Add fork helper method (#13397) fix gem provider ensure=>latest bug (#12101) Make Puppet::Util::absolute_path? usable in autoloader (#12101) Add shared context for specs to imitate windows or posix Conflicts: lib/puppet/util.rb spec/unit/util_spec.rb
2012-03-28(#12101) Add shared context for specs to imitate windows or posixPatrick Carlisle1-29/+2
Add "windows" and "posix" shared contexts to rspec. If you give :as_platform => :posix or :as_platform => :windows as argument to a describe block, it will automatically stub the relevant facts and path behavior to imitate windows or posix.
2012-03-20(#7749) Improvements to handling settings, bootstrapping puppetcprice1-2/+6
Major changes include: * support multiple config files (/etc/puppet, ~/.puppet). we no longer use "run_mode" to determine the location of the config file. * remove all references to application run_mode/state from defaults * make the typing of settings a little more strict * create a new setting type for directories, to make us a little less vulnerable to the terrible matching algorithm in FileSetting
2012-01-24Revert "(#12101) Add shared context for specs to imitate windows or posix"Patrick Carlisle1-2/+29
This reverts commit edc544d73bc8f9f7de07de4b30e344d1f4db3178. This doesn't work with rspec < 2.6.0 and it's breaking continuous integration.
2012-01-24(#12101) Add shared context for specs to imitate windows or posixPatrick Carlisle1-29/+2
Add "windows" and "posix" shared contexts to rspec. If you give :as_platform => :posix or :as_platform => :windows as argument to a describe block, it will automatically stub the relevant facts and path behavior to imitate windows or posix.
2011-09-27Fix issues with Windows based file URIsJosh Cooper1-3/+4
Previously, specifying a Windows file URI of the form 'file:///C:/foo' as a file source failed to strip the leading slash when attempting to source the file. Also there was ambiguity after values were munged (a value of the form 'C:/foo' could either be a Windows file path or a URI whose scheme is 'C'). This commit changes the file source to be more deliberate in how it validates source properties, including only allowing absolute paths and 'puppet' and 'file' URIs, which are both absolute and hierarchical. Also it uses the Puppet::Util.path_to_uri method to handle file path to URI translation issues. Previously, if a request was created using a Windows file URI of the form 'file:///C:/foo', then the set_uri_key method wasn't stripping the leading slash, and setting the request key to '/C:/foo'. This caused problems when attempting to collect metadata for Windows files. This commit changes the request class to use the Puppet::Util.uri_to_path method to handle URI path to file path translation issues. Previously, if a file URI was created programmatically using ruby's built-in URI class, such as occurs when specifying file source URIs, then calling URI#to_s omits the authority component, e.g. 'file:/foo' instead of 'file:///foo'. This commit changes the URI regex to not require two slashes, but note that the order of operations is important as Windows file paths will match the URI regex and can be successfully parsed: URI.parse('c:/foo').scheme == 'c'
2011-08-30Merge branch 'feature/2.7.x/9051-storeconfig-backend-should-be-configurable' ↵Jeff McCune1-0/+21
into 2.7.x * feature/2.7.x/9051-storeconfig-backend-should-be-configurable: (#9051) de-ActiveRecord-ify Collection expressions. (#9051) Port query tests into the indirection. (#9051) Implement the `resource` terminus for StoreConfigs. (#9051) Make generic tagging imported resource origins. (#9051) Whitespace cleanup for puppet/parser/collector (#9051) Dead code elimination in the compiler terminus. (#9051) Get the compiler out of the ActiveRecord business. (#9051) Implement the StoreConfigs indirection itself. (#9051) Add configuration around StoreConfigs indirection. Reviewed-by: Jeff McCune
2011-08-24(#8410) Use absolute_path? for Puppet::Parameter::Path validationNick Lewis1-18/+20
A Puppet::Parameter::Path's value is valid if it is fully qualified (or in the case of an array, if each of its elements is fully qualified). This class was previously using its own method to validate whether a path was fully qualified, which was different from the rules applied by absolute_path?. Now that we have a dedicated method for this, it is used here for consistency.
2011-08-23(#9051) Implement the StoreConfigs indirection itself.Daniel Pittman1-0/+21
We now have a StoreConfigs terminus base class, and concrete uses in a number of indirections, along with testing to ensure they behave as expected. Signed-off-by: Daniel Pittman <daniel@puppetlabs.com>
2011-08-19Remove use of Util::Cacher in FileServing::ConfigurationNick Lewis1-1/+1
This class was using Util::Cacher for its singleton instance, when that was unnecessary. The FileServing::Configuration instance already manages whether or not to reparse its config file, based on whether it has changed. Thus, there is no need for it to be manually expired via the cacher. Reviewed-By: Jacob Helwig <jacob@puppetlabs.com> (cherry picked from commit 4bad729f56c26d8154cd0f20614fa4e478de9d40)
2011-08-18maint: remove inaccurate copyright and license statements.Daniel Pittman3-12/+0
For a while Luke, and other authors, injected a created tag, copyright statement, and "All rights reserved" into every new file they added to the Puppet project. This isn't really true, and we have a global license covering the code, so we have now stripped out all those old tags. Signed-off-by: Daniel Pittman <daniel@puppetlabs.com>
2011-07-20(#6787) Add `default_to` for options.Daniel Pittman1-0/+113
This implement support for options with default values, allowing faces to set those values when not invoked. This can eliminate substantial duplicate code from actions, especially when there are face-level options in use. Reviewed-By: Pieter van de Bruggen <pieter@puppetlabs.com>
2011-07-13(#7699) Help command should only list options onceDan Bode1-1/+1
The problem was caused by the fact that the options method returns a list of options that treated the aliases as seperate options. The fix is to only maintain a list of options and not add all aliases to the options list.
2011-06-22(#8048) Gem install puppet no longer fails if rdoc enabled.Josh Cooper1-2/+1
Pre-released versions of faces may have used the "desc" option, which was later changed to "description", and an alias provided for "desc". The previous fix for 8048 removed this backwards compatibility (since it was never released to customers). This commit fixes the test case that assumed the "desc" option was still available. Reviewed-By: Daniel Pittman <daniel@puppetlabs.com>
2011-05-26Maint: Fix ellipses for short descriptionsnfagerlund1-2/+9
Previously, we were adding ellipsis to any short_description, which was misleading; they were only necessary when we were truncating in the _middle_ of a paragraph. This commit changes the behavior, and updates the tests to show when we expect ellipsis. Paired-with: Matt Robinson <matt@puppetlabs.com>
2011-05-03(#7279) Adding some basic file actionsLuke Kanies1-0/+6
Add the ability to download a file into the local filebucket using a puppet URI or from disk. Also, the ability to store into the filebucket. These provide at least basic UI for moving data around using the filebucket service, and act as an example of how further work can be done. Also, update the code to eliminate a couple of redundant checks on arguments, and add some basic testing around the actions. Mostly only that they exist, at this point. Reviewed-By: Daniel Pittman <daniel@puppetlabs.com>
2011-04-29Merge branch 'bug/2.7.x/7221-whitespace-stripping-for-documentation' into 2.7.xDaniel Pittman1-14/+53
2011-04-29(#7221) Strip bad whitespace from face and action docs.Daniel Pittman1-14/+53
We now strip whitespace in face (and related) documentation in two places: We strip any trailing whitespace on each line, just because. We strip any leading indent, but not all leading whitespace, from the text. That is, we strip the *minimum* amount of whitespace that we can take from every line in the documentation without changing the overall content. Reviewed-By: Pieter van de Bruggen <pieter@puppetlabs.com>
2011-04-29Merge branch 'tickets/2.7.x/7289' into 2.7.xPieter van de Bruggen1-2/+5
2011-04-29(#7289) Specify order for option decorations.Pieter van de Bruggen1-2/+5
`before_action` decorations should always resolve in resolution order from most general (inherited from furthest away) to most specific (declared on the instance), and should always execute Face-level option decorations before action-level option decorations. `after_action` decorations should execute in the opposite order. Reviewed-By: Daniel Pittman
2011-04-27(#6962) Finish documentation API on Face options.Daniel Pittman1-0/+2
This extends the last of the documentation support, down into options, so they can be described as expected. In the process we split out the modular docs API into a full and short version options only want short docs, but the behaviours are identical to the full version.
2011-04-26(#6962) Move documentation support into a module.Daniel Pittman1-5/+44
Given that we have identical documentation behaviour in the face and action code, it should properly be written once. So, move it into a module, extend the other classes with it, and have done.
2011-04-26(#6962) Extend documentation API for Faces.Daniel Pittman1-20/+163
This adds the remaining documentation mechanisms to the Face instances, allowing them to build and report correct documentation, licensing and ownership for the help face to build on.
2011-04-19maint: mangle grammer in rspec to avoid Jenkins fail...Daniel Pittman1-2/+2
Apparently 'expect { ... } .not_to' is considered unnecessary contortion by the rspec authors, so we only have 'expect { ... } .to_not' in some versions of rspec. This updates the test code to reflect that bit of annoyance.
2011-04-19Merge branch 'bug/2.7.x/7132-a-summary-with-a-newline-is-accepted' into 2.7.xDaniel Pittman1-0/+35
2011-04-19(#6962) Add 'description' to faces and action.Daniel Pittman1-0/+35
This adds the 'description' method to the faces and actions, as well as structured testing to ensure that the DSL works as expected. Reviewed-By: Max Martin <max@puppetlabs.com>
2011-04-18(#7131) Remove support for optional arguments to optionsMax Martin1-25/+29
As per the design decision documented in #7131, optional arguments to options will no longer be supported. This patch causes such optional arguments to raise an error, and tests for this behavior. Also cleaned up some confusing use of the term "subject" in specs. Paired-with: Daniel Pittman
2011-04-13(#6830) Fix UTF-8 encoding issue for Ruby 1.9Matt Robinson1-0/+1
If you're going to use special characters in a file and use Ruby 1.9 you need to specify the character encoding at the top of the file. Reviewed-by: Daniel Pittman <daniel@puppetlabs.com>
2011-04-13maint: ensure we handle '-foo=' options correctly in faces.Daniel Pittman1-1/+7
This is legal, and defines an option with an argument for optparse; we want to make sure that we stay consistent with that in our code handling the same sort of inputs. This also adds a framework for later testing any other strange naming bits and bobs we find around option handling. Reviewed-By: Pieter van de Bruggen <pieter@puppetlabs.com>
2011-04-13maint: clean up the spec test headers in bulk.Daniel Pittman6-2/+2
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-07Merge puppet-interfaces into puppet.Daniel Pittman1-0/+134
This joins the two repositories, including full history, into a single run, as well as landing the interfaces work on the next branch ready for release.
2011-04-04(#6749) detect duplicate aliases in a single option statement.Daniel Pittman1-0/+14
This ensures that an option declaration that shadows itself is found, and reported to the user, rather than silently eating one of the two. This could have actually lost, for example, the distinction between an argument-requiring and an argument-missing variant of the same thing. Reviewed-By: Pieter van de Bruggen <pieter@puppetlabs.com>
2011-04-04(#6749) implementing option handling in CLI string wrapperDaniel Pittman1-0/+120
The purpose of this is to adapt the generic option support in our strings to the command line; we adapt the generic option information to optparse, and establish our environment early in the process to ensure that we can play nice with Puppet::Application for the moment. In the process we ensure that we detect, and report, conflicts in option naming across the board. Additionally, when an option is declared with multiple aliases, we insist that either all, or none, of them take an argument. To support this we support introspecting options having an optional argument, as well as documentation and all. Reviewed-By: Pieter van de Bruggen <pieter@puppetlabs.com>