summaryrefslogtreecommitdiff
path: root/spec/unit/provider/package/gem_spec.rb
AgeCommit message (Collapse)AuthorFilesLines
2014-05-01Merge branch 'pull-2455'Adrien Thebo1-0/+10
2014-04-30(PUP-2014) Make gem provider match on a single gem namervalente1-0/+10
Currently the gem provider will match gemname$, for example with bundler this will return quite a long list of anything ending with bundler. When a match returns a longer list, it will actually connect and try to pull the latest gem again, thus increasing the WAN usage and rubygems.org usage when not necessary. The proposed fix adds a ^ in front of the name var to ensure it begins with the gemname.
2014-04-02(maint) Consolidate redundant join_options implementations.Peter Huene1-1/+1
Moving the implementation of join_options into the base package provider. This gives a consistent behavior between all package providers that support install_options.
2014-03-24(maint) Update gem provider spec for recent change.Peter Huene1-2/+2
The spec had an example which was expecting a nil install_options by checking the 6th element in an array. With the change to not append the install_options unless specified, the example was passing but the functionality no longer matched the example. Changing the example to ensure 5 elements were passed to execute instead of the previous 6.
2014-03-20(PUP-620) Add spec examples for yum install_options.Peter Souter1-0/+15
Checks nil install_options. Checks plain values and hash key-pairs.
2013-12-28(PUP-1051) Add rspec test to verify fixPedro CĂ´rte-Real1-0/+12
2013-03-08(#19663) Remove --include-dependencies flag in gem package providerReinaldo de Souza Junior1-11/+6
Without this patch applied the gem package provider will always pass the `--include-dependencies` flag to the gem command. This flag has been deprecated in Rubygems for quite some time. The behavior of including dependencies when installing a gem has been the default for some time, so this patch does not change behavior for any recent version of Rubygems since 0.9.5. Here is the comment from the pull request: This is a good explanation about the option: rubygems/rubygems#385 It was already deprecated since rubygems 0.9.5 and was the default option since then. Unless someone is using a version of rubygems from mid 2007, this option is never being used https://github.com/rubygems/rubygems/blob/a00fc76fb6b959385331715c500af1eb25590405/History.txt#L1451
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-08-14Merge branch '2.7.x' into 3.xJeff McCune1-0/+12
* 2.7.x: (#15346) Add spec test for --source when checking latest (#15346) add --source to the gem list command (Maint) Add logging for when Puppet is enabled/disabled. (#15521) Convert to using host stub wrapper Conflicts: acceptance/tests/modules/install/nonexistent_directory.rb acceptance/tests/modules/search/by_description.rb acceptance/tests/modules/search/by_keyword.rb acceptance/tests/modules/search/by_module_name.rb acceptance/tests/modules/search/communication_error.rb acceptance/tests/modules/search/formatting.rb acceptance/tests/modules/search/multiple_search_terms.rb acceptance/tests/modules/search/no_results.rb lib/puppet/agent/locker.rb
2012-08-14(#15346) Add spec test for --source when checking latestJeff McCune1-0/+12
This patch adds a single spec test to ensure checking the latest version of the gem honors the source attribute and passes this as an option to the gemlist method.
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-05-02(#14288) gem provider should tolerate bad lines.Daniel Pittman1-1/+17
Previously, when the output of the gem command contained a line that didn't match it was returned as `nil` - but the rest of the provider didn't handle that value at all! That led to any mismatch causing various failures to dereference `nil` as a hash, and general failure. This fixes this to behave significantly better by just omitting that entry in the result, returning only the expected content. Signed-off-by: Daniel Pittman <daniel@puppetlabs.com>
2012-03-29(#13397) fix gem provider ensure=>latest bugChris Price1-0/+15
As of 2.7.12, if you had "ensure=>latest" for any gem package resource, puppet would not correctly detect that the gem was already installed and would attempt to install it on every run. (This was because the "latest" method on the gem provider was always returning an array, when it should always be returning a single value.)
2012-01-23(#2279) Handle providers with multiple installed versions - ruby gemsMatt Robinson1-12/+35
Ruby gems can have multiple versions installed, and the current implementation of the gem provider only reads the very latest installed version when self.instances is called. This leads to Puppet potentially reinstalling the gem on every run if the Puppet manifest specifies a gem that *is* installed, but is not the latest version installed. This does require a change to how the package type checks if ensure is insync? to handle multiple versions for the 'is' ensure value, but the change is backward compatible with the providers that specify single versions.
2012-01-23(#2279) Convert package specs to not use mocksMatt Robinson1-42/+35
In the next commit I want to extend the specs, and I'm not confident that the mocked resource does a good job of testing the changes I'm about to make.
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-04-07Merge branch '2.6.x' into nextMax Martin1-1/+11
* 2.6.x: (maint) Indentation fixes (#6490) Add plugin initialization callback system to core Fix #4339 - Locally save the last report to $lastrunreport Fix #4339 - Save a last run report summary to $statedir/last_run_summary.yaml Fixed #3127 - removed legacy debug code Fixed #3127 - Fixed gem selection regex (#5437) Invalidate cached TypeCollection when there was an error parsing (#6937) Adjust formatting of recurse's desc (#6937) Document the recurse parameter of File type. (#6893) Document the cron type in the case of specials. (#5670) Don't trigger refresh from a failed resource Fixed #6554 - Missing $haveftool if/else conditional in install.rb breaking Ruby 1.9 Conflicts (Manually resolved): lib/puppet/application/agent.rb lib/puppet/application/apply.rb lib/puppet/configurer.rb lib/puppet/resource/type_collection.rb lib/puppet/type/file.rb spec/integration/configurer_spec.rb spec/unit/application/agent_spec.rb spec/unit/application/apply_spec.rb spec/unit/configurer_spec.rb spec/unit/indirector/report/yaml_spec.rb spec/unit/resource/type_collection_spec.rb Paired-with: Nick Lewis
2011-04-04Fixed #3127 - Fixed gem selection regexJames Turnbull1-1/+11
Previously if the gem json_pure was installed and you requested the gem json then the regex matched too soon and falshly indicated that the json gem was already installed. Also updated to add the --no-ri and no-rdoc options and fix tests.
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-67/+67
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/+87
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-87/+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/+87
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