summaryrefslogtreecommitdiff
path: root/spec/integration/provider
AgeCommit message (Collapse)AuthorFilesLines
2011-03-03(#6582) eliminate fakeparsefile helper method.Daniel Pittman1-15/+3
This was a helper that implemented rspec style "shared behaviour" for Test::Unit; now that we have moved on we can use the upstream implementation instead. This eliminates a whole bit of code we have to maintain. Reviewed-By: Nick Lewis <nick@puppetlabs.com>
2011-03-03(#6582) Eliminate the old fakedata helper method.Daniel Pittman1-4/+2
This is replaced with the new my_fixture{,s} methods; old fixture data is ported into the spec tests at the same time, but left where it was against unit tests that require it. Reviewed-By: Nick Lewis <nick@puppetlabs.com>
2011-01-06Merge branch '2.6.x' into nextNick Lewis3-13/+4
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
2011-01-05(#5771): Fix spec failures associated with rspec upgradeNick Lewis1-1/+0
Due to changes in the spec_helper, some of the specs that use puppettest were failing when run individually. In the future, it would be nice to remove puppettest from the specs entirely, as it's old, crufty, and only used for a couple of things. Paired-With: Matt Robinson
2011-01-04(#5771) Upgrade rspec to version 2Matt Robinson2-12/+4
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
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-09-03[#4308] Remove puppettest from specsMatt Robinson1-5/+5
The less stuff being done in the spec_helper the better for reasoning about what's happening in the tests. puppettest.rb does a lot of things that aren't necessary for the specs, so this patch gets those things out of the spec_helper. Reviewed by: Jesse Wolfe
2010-07-09Code smell: Two space indentationMarkus Roberts3-41/+41
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-07-09Code smell: Use string interpolationMarkus Roberts1-2/+2
* Replaced 83 occurances of (.*)" *[+] *([$@]?[\w_0-9.:]+?)(.to_s\b)?(?! *[*(%\w_0-9.:{\[]) with \1#{\2}" 3 Examples: The code: puts "PUPPET " + status + ": " + process + ", " + state becomes: puts "PUPPET " + status + ": " + process + ", #{state}" The code: puts "PUPPET " + status + ": #{process}" + ", #{state}" becomes: puts "PUPPET #{status}" + ": #{process}" + ", #{state}" The code: }.compact.join( "\n" ) + "\n" + t + "]\n" becomes: }.compact.join( "\n" ) + "\n#{t}" + "]\n" * Replaced 21 occurances of (.*)" *[+] *" with \1 3 Examples: The code: puts "PUPPET #{status}" + ": #{process}" + ", #{state}" becomes: puts "PUPPET #{status}" + ": #{process}, #{state}" The code: puts "PUPPET #{status}" + ": #{process}, #{state}" becomes: puts "PUPPET #{status}: #{process}, #{state}" The code: res = self.class.name + ": #{@name}" + "\n" becomes: res = self.class.name + ": #{@name}\n" * Don't use string concatenation to split lines unless they would be very long. Replaced 11 occurances of (.*)(['"]) *[+] *(['"])(.*) with 3 Examples: The code: o.define_head "The check_puppet Nagios plug-in checks that specified " + "Puppet process is running and the state file is no " + becomes: o.define_head "The check_puppet Nagios plug-in checks that specified Puppet process is running and the state file is no " + The code: o.separator "Mandatory arguments to long options are mandatory for " + "short options too." becomes: o.separator "Mandatory arguments to long options are mandatory for short options too." The code: o.define_head "The check_puppet Nagios plug-in checks that specified Puppet process is running and the state file is no " + "older than specified interval." becomes: o.define_head "The check_puppet Nagios plug-in checks that specified Puppet process is running and the state file is no older than specified interval." * Replaced no occurances of do (.*?) end with {\1} * Replaced 1488 occurances of "([^"\n]*%s[^"\n]*)" *% *(.+?)(?=$| *\b(do|if|while|until|unless|#)\b) with 20 Examples: The code: args[0].split(/\./).map do |s| "dc=%s"%[s] end.join(",") becomes: args[0].split(/\./).map do |s| "dc=#{s}" end.join(",") The code: puts "%s" % Puppet.version becomes: puts "#{Puppet.version}" The code: raise "Could not find information for %s" % node becomes: raise "Could not find information for #{node}" The code: raise Puppet::Error, "Cannot create %s: basedir %s is a file" % [dir, File.join(path)] becomes: raise Puppet::Error, "Cannot create #{dir}: basedir #{File.join(path)} is a file" The code: Puppet.err "Could not run %s: %s" % [client_class, detail] becomes: Puppet.err "Could not run #{client_class}: #{detail}" The code: raise "Could not find handler for %s" % arg becomes: raise "Could not find handler for #{arg}" The code: Puppet.err "Will not start without authorization file %s" % Puppet[:authconfig] becomes: Puppet.err "Will not start without authorization file #{Puppet[:authconfig]}" The code: raise Puppet::Error, "Could not deserialize catalog from pson: %s" % detail becomes: raise Puppet::Error, "Could not deserialize catalog from pson: #{detail}" The code: raise "Could not find facts for %s" % Puppet[:certname] becomes: raise "Could not find facts for #{Puppet[:certname]}" The code: raise ArgumentError, "%s is not readable" % path becomes: raise ArgumentError, "#{path} is not readable" The code: raise ArgumentError, "Invalid handler %s" % name becomes: raise ArgumentError, "Invalid handler #{name}" The code: debug "Executing '%s' in zone %s with '%s'" % [command, @resource[:name], str] becomes: debug "Executing '#{command}' in zone #{@resource[:name]} with '#{str}'" The code: raise Puppet::Error, "unknown cert type '%s'" % hash[:type] becomes: raise Puppet::Error, "unknown cert type '#{hash[:type]}'" The code: Puppet.info "Creating a new certificate request for %s" % Puppet[:certname] becomes: Puppet.info "Creating a new certificate request for #{Puppet[:certname]}" The code: "Cannot create alias %s: object already exists" % [name] becomes: "Cannot create alias #{name}: object already exists" The code: return "replacing from source %s with contents %s" % [metadata.source, metadata.checksum] becomes: return "replacing from source #{metadata.source} with contents #{metadata.checksum}" The code: it "should have a %s parameter" % param do becomes: it "should have a #{param} parameter" do The code: describe "when registring '%s' messages" % log do becomes: describe "when registring '#{log}' messages" do The code: paths = %w{a b c d e f g h}.collect { |l| "/tmp/iteration%stest" % l } becomes: paths = %w{a b c d e f g h}.collect { |l| "/tmp/iteration#{l}test" } The code: assert_raise(Puppet::Error, "Check '%s' did not fail on false" % check) do becomes: assert_raise(Puppet::Error, "Check '#{check}' did not fail on false") do
2010-06-28[#3994-part 2] rename integration tests to *_spec.rbMarkus Roberts3-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
2009-10-23Fix for #2745 fakedata tests not workingMarkus Roberts1-4/+4
The old fakedata test facility was not playing nicely with the spec tests; although it looped through all the files failures in any example file after the first were being ignored because of the way fakedataparse was interacting with the before blocks. Signed-off-by: Markus Roberts <Markus@reality.com>
2009-06-06Changed indentation to be more consistent with style guide (4 spaces per level)Ian Taylor1-11/+11
2009-01-22Fix #1560Paul Lathrop1-0/+25
Adds an rspec test which demonstrates #1560 and a custom 'process' method for the aliases provider to fix it. The default processing uses split() to break the line into records on the separator, which breaks if records can contain the separator. The custom method I've added uses a 'limited' split() to break the line on the first separator only. This commit fixes #1560 Signed-off-by: Paul Lathrop <paul@tertiusfamily.net>
2008-10-08Moving some test/ package tests to rspec integration testsLuke Kanies1-0/+26
and disabling a gem test that hangs forever for me. Signed-off-by: Luke Kanies <luke@madstop.com>
2008-07-03Removing all of the code related to the interface type.Luke Kanies1-41/+0
2008-07-03Doing what I can to fix #1128, but just in preparation for removing 'interface'.Luke Kanies1-0/+41
This type needs to be started again from scratch, and I'm not going to do so for 0.24.5. In particular, the model for red hat and sunos need to match -- they should both use the device name as the actual name. Signed-off-by: Luke Kanies <luke@madstop.com>
2008-06-16Fixed #1369 - the init service provider now supports HP-UX.Luke Kanies1-0/+32
I've only added an integration test for the provider, since that's all I've changed; none of the service providers have rspec tests yet.