summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordanielsdeleo <dan@opscode.com>2013-12-27 11:13:46 -0800
committerdanielsdeleo <dan@opscode.com>2013-12-27 11:13:46 -0800
commited254383c4e37b28a8ebe28e0efabf262d0cf946 (patch)
tree4fa4bd27d9e73c8b5b67d0e2b8bdad4a6a09bf24
parentf97ed8648996b94972cac9e2ba53152d76f5a4e3 (diff)
downloadchef-ed254383c4e37b28a8ebe28e0efabf262d0cf946.tar.gz
Fix subcommand loader specs for really old rubygems
-rw-r--r--spec/unit/knife/core/subcommand_loader_spec.rb14
1 files changed, 11 insertions, 3 deletions
diff --git a/spec/unit/knife/core/subcommand_loader_spec.rb b/spec/unit/knife/core/subcommand_loader_spec.rb
index 08e6a0bbc1..033649bbc2 100644
--- a/spec/unit/knife/core/subcommand_loader_spec.rb
+++ b/spec/unit/knife/core/subcommand_loader_spec.rb
@@ -47,7 +47,7 @@ describe Chef::Knife::SubcommandLoader do
$LOAD_PATH.should_receive(:map).and_return([])
if Gem::Specification.respond_to? :latest_specs
Gem::Specification.should_receive(:latest_specs).with(true).and_return(gems)
- gems[0].should_receive(:matches_for_glob).with(/chef\/knife\/\*\.rb{(.*),\.rb,(.*)}/).and_return(gem_files)
+ gems[0].should_receive(:matches_for_glob).with(/chef\/knife\/\*\.rb\{(.*),\.rb,(.*)\}/).and_return(gem_files)
else
Gem.source_index.should_receive(:latest_specs).with(true).and_return(gems)
gems[0].should_receive(:require_paths).twice.and_return(['lib'])
@@ -89,7 +89,11 @@ describe Chef::Knife::SubcommandLoader do
end
it "searches rubygems for plugins" do
- Gem::Specification.should_receive(:latest_specs).and_call_original
+ if Gem::Specification.respond_to?(:latest_specs)
+ Gem::Specification.should_receive(:latest_specs).and_call_original
+ else
+ Gem.source_index.should_receive(:latest_specs).and_call_original
+ end
@loader.subcommand_files.each do |require_path|
require_path.should match(/chef\/knife\/.*|plugins\/knife\/.*/)
end
@@ -101,7 +105,11 @@ describe Chef::Knife::SubcommandLoader do
end
it "searches rubygems for plugins" do
- Gem::Specification.should_receive(:latest_specs).and_call_original
+ if Gem::Specification.respond_to?(:latest_specs)
+ Gem::Specification.should_receive(:latest_specs).and_call_original
+ else
+ Gem.source_index.should_receive(:latest_specs).and_call_original
+ end
@loader.subcommand_files.each do |require_path|
require_path.should match(/chef\/knife\/.*|plugins\/knife\/.*/)
end