summaryrefslogtreecommitdiffstats
path: root/spec/unit/rails
Commit message (Collapse)AuthorAgeFilesLines
* Merge branch '2.6.next' into 2.7.nextMax Martin2011-04-271-0/+8
|\ | | | | | | | | | | | | | | | | * 2.6.next: (#3420) Nagios "name" attribute does not output correctly (#4487) When setting environment on a host, ensure it is a string. add test for ticket 7101 (#6487) Add some testing for OS X version support in DirectoryService provider (#6487) Directoryservice provider will fail in future OS releases
| * (#4487) When setting environment on a host, ensure it is a string.Josh Cooper2011-04-261-0/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Before this change when environment strings were read out of the storeconfigs database, they were eventually converted up to Puppet::Node::Environment objects. When these objects are returned to the storeconfigs database, ActiveRecord dumps them as YAML, which begins the death-spiral of YAML. This change makes it so the host will always store the environment as a string, preventing the Puppet::Node::Environment object from being YAMLized, and stored as such in the database. This change was based on one by Richard Crowley. Paired-with: Jacob Helwig <jacob@puppetlabs.com> Reviewed-by: Jesse Wolfe <jesse@puppetlabs.com> Signed-off-by: Richard Crowley <r@rcrowley.org>
* | maint: clean up the spec test headers in bulk.Daniel Pittman2011-04-133-6/+3
| | | | | | | | | | | | | | 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.
* | maint: just require 'spec_helper', thanks rspec2Daniel Pittman2011-04-083-3/+3
| | | | | | | | | | | | | | | | | | | | | | 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>
* | Merge branch '2.6.x' into nextNick Lewis2011-01-063-9/+3
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: Rakefile lib/puppet/resource/type_collection.rb lib/puppet/simple_graph.rb lib/puppet/transaction.rb lib/puppet/transaction/report.rb lib/puppet/util/metric.rb spec/integration/indirector/report/rest_spec.rb spec/spec_specs/runnable_spec.rb spec/unit/configurer_spec.rb spec/unit/indirector_spec.rb spec/unit/transaction/change_spec.rb
| * (#5771) Upgrade rspec to version 2Matt Robinson2011-01-043-9/+3
| | | | | | | | | | | | | | | | | | The biggest change is that we no longer need to monkey patch rspec to get confine behavior. Describe blocks can now be conditional like confine used to be. "describe" blocks with "shared => true" are now "shared_examples_for". Paired-With: Nick Lewis
| * maint: Fix tests that don't run on their ownMatt Robinson2010-12-162-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | From the spec directory I found all the specs that fail when run on their own. for TEST in `find . -name "*.rb" -type f`; do spec $TEST > /dev/null 2>&1 if [[ $? != 0 ]]; then echo $TEST fi done All of them were cases of missing requires. Paired-with: Nick Lewis <nick@puppetlabs.com>
* | maint: Use expand_path when requiring spec_helper or puppettestMatt Robinson2010-12-063-3/+3
| | | | | | | | | | | | | | | | | | 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
* | maint: Fix tests that don't run on their ownMatt Robinson2010-11-222-0/+2
|/ | | | | | | | | | | | | | | From the spec directory I found all the specs that fail when run on their own. for TEST in `find . -name "*.rb" -type f`; do spec $TEST > /dev/null 2>&1 if [[ $? != 0 ]]; then echo $TEST fi done All of them were cases of missing requires. Paired-with: Nick Lewis <nick@puppetlabs.com>
* [#4397]+[#4344] Move type-name resolution out of Puppet::Resource into the ↵Jesse Wolfe2010-08-031-1/+1
| | | | | | | | | | | | | | | | | | AST resources. Move type-name resolution out of Puppet::Resource into the AST resources. Move find_resource_type out of Puppet::Resource into Scope Thus, never pass unqualified type names to Puppet::Resource objects. Thus, Puppet::Resource objects don't need the namespace property, and Puppet::Resource objects never consult the harddrive to look for .pp files that might contain their type definitions, Thus, performance is improved. Also removes the temporary fix for #4257 that caused #4397 (The code was too eager to look for a class in the topscope) Paired-With: Paul Berry <paul@puppetlabs.com> Signed-off-by: Jesse Wolfe <jes5199@gmail.com>
* [#4247] storeconfigs was calling Puppet::Parser::Resource.new with the wrong ↵Jesse Wolfe2010-07-181-0/+16
| | | | | | | | | | | | | arguments When the interface to Puppet::Resource changed, its subclass Puppet::Parser::Resource was also affected. One case of initializing those objects did not get updated when the code changed, causing storeconfigs to break. Also, this patch adds a error message that would have made it easier to catch this problem (as puppet could consume all memory and die trying to print the old error message)
* Code smell: Two space indentationMarkus Roberts2010-07-093-217/+217
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* [#3994-part 3] rename spec tests from *_spec_spec to *_spec.rbMarkus Roberts2010-06-283-0/+0
| | | | Part 2 re-did the change on the spec files, which it shouldn't have.
* [#3994-part 2] rename integration tests to *_spec.rbMarkus Roberts2010-06-283-0/+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
* maint: Fixing test to reflect that host environment assignment now takes an ↵Matt Robinson2010-06-251-1/+1
| | | | object instead of a string
* [#3994] rename the specs to have _spec.rb at the endMarkus Roberts2010-06-233-0/+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
* Removing Resource::Reference classesLuke Kanies2010-02-171-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | This commit is hopefully less messy than it first appears, but it's certainly cross-cutting. The reason for all of this is that we previously only looked up builtin resource types from outside the parser, but now that the defined resource types are available globally via environments, we can push that lookup code to Resource. Once we do that, however, we have to have environment and namespace information in every resource. Here I remove the Resource::Reference classes (except the AST class), and use Resource instances instead. I did this because the shared code between the two classes got incredibly complicated, such that they should have had a hierarchical relationship disallowed by their constants. This complexity convinced me just to get rid of References entirely. I also make Puppet::Parser::Resource a subclass of Puppet::Resource. There are still broken tests in test/, but this was a big enough commit I wanted to get it in. Signed-off-by: Luke Kanies <luke@reductivelabs.com>
* Fixing #2964 updated resources cannot be collected until they are exported twiceMarkus Roberts2009-12-231-0/+20
| | | | | | | This logic had a bug where it would not insert data if it had just been deleted. Signed-off-by: Jesse Wolfe <jes5199@gmail.com>
* Feature #2378 - Implement "thin_storeconfigs"Brice Figureau2009-07-181-0/+72
| | | | | | | | | | | | | | | Thin storeconfigs is a limited version of storeconfigs that is more performant and still allows the exported/collected resources system wich is the primary use of storeconfigs. It works by storing to the database only the exported resources, tags and host facts. Since usually those exported resources are less than the number of total resources for a node, it is expected to be faster than regular storeconfigs (especially for the first run). Signed-off-by: Brice Figureau <brice-puppet@daysofwonder.com>
* Always providing a value for 'exported' on Rails resourcesLuke Kanies2009-06-031-0/+45
| | | | | | | | | | | We often didn't set a value, unless it was true, which meant that if it had previously been true but was now false, we didn't fix it. We also were not always saving modified resources, which in some cases resulted in work not getting saved. Signed-off-by: Luke Kanies <luke@madstop.com>
* Fixing #2187 - Puppet::Resource is expected by Rails supportLuke Kanies2009-04-242-0/+91
| | | | | | | | | | | | | We previously used and expected Puppet::Parser::Resource instances, but 0.25 converts them all to Puppet::Resource instances before they're passed out of the compiler, so the Rails integration had to be changed to expect that. There's still some muddling, because the rails resources only generate parser resources, but that works for now because that's what we expect when collecting resources. Signed-off-by: Luke Kanies <luke@madstop.com>
* Adding ActiveRecord terminus classes for Node and Facts.Luke Kanies2009-04-221-0/+91
This is most of the way to replacing standard StoreConfigs integration with the Indirector. We still need to convert the Catalog and then change all of the integraiton points (which is mostly the 'store' call in the Compiler). Signed-off-by: Luke Kanies <luke@madstop.com>