summaryrefslogtreecommitdiff
path: root/features/steps
diff options
context:
space:
mode:
authorChris Walters <cw@opscode.com>2010-08-12 15:28:46 -0700
committerDaniel DeLeo <dan@opscode.com>2010-08-17 11:14:27 -0700
commite29e3894f769a710e910a6f6acb4c34d264187cc (patch)
tree7778c2b0ea721d83129d71c518ebd6a581d6ae8f /features/steps
parentf4cbccf16ede12c28adc529c1a495ccda5ced1d7 (diff)
downloadchef-e29e3894f769a710e910a6f6acb4c34d264187cc.tar.gz
Adding some tests for cookbook upload
Diffstat (limited to 'features/steps')
-rw-r--r--features/steps/cookbook_steps.rb9
-rw-r--r--features/steps/response_steps.rb6
2 files changed, 14 insertions, 1 deletions
diff --git a/features/steps/cookbook_steps.rb b/features/steps/cookbook_steps.rb
index e830d42821..f835fbed79 100644
--- a/features/steps/cookbook_steps.rb
+++ b/features/steps/cookbook_steps.rb
@@ -219,6 +219,8 @@ Then /I fully upload a sandboxed cookbook (force-)?named '([^\']+)' versioned '(
full_path = File.join(datadir, "cookbooks_not_uploaded_at_feature_start", cookbook_name, manifest_record[:path])
begin
+ csum_entry = @stash['sandbox_response']['checksums'][manifest_record[:checksum]]
+ next unless csum_entry['url']
url = @stash['sandbox_response']['checksums'][manifest_record[:checksum]]['url']
upload_to_sandbox(full_path, manifest_record[:checksum], url)
rescue
@@ -310,3 +312,10 @@ Then /^the downloaded cookbook file contents should match the pattern '(.+)'$/ d
@downloaded_cookbook_file_contents.should =~ /#{pattern}/
end
+Then /^the dependencies in its metadata should be an empty hash$/ do
+ inflated_response.metadata.dependencies.should == {}
+end
+
+Then /^the metadata should include a dependency on '(.+)'$/ do |key|
+ inflated_response.metadata.dependencies.should have_key(key)
+end
diff --git a/features/steps/response_steps.rb b/features/steps/response_steps.rb
index bc8996496f..089e634aed 100644
--- a/features/steps/response_steps.rb
+++ b/features/steps/response_steps.rb
@@ -60,6 +60,10 @@ Then /^the inflated responses key '(.+)' item '(\d+)' key '(.+)' should be '(.+)
inflated_response[key][index.to_i][sub_key].should == to_equal
end
+Then /^the inflated responses key '(.+)' sub-key '(.+)' should be an empty hash$/ do |key, sub_key|
+ inflated_response[key][sub_key].should == {}
+end
+
Then /^the inflated responses key '(.+)' should be '(\d+)' items long$/ do |key, length|
inflated_response[key].length.should == length.to_i
end
@@ -127,7 +131,7 @@ Then /^the stringified response should be the stringified '(.+)'$/ do |stash_key
end
Then /^the inflated response should be a kind of '(.+)'$/ do |thing|
- self.inflated_response.should be_a_kind_of(thing)
+ self.inflated_response.should be_a_kind_of(eval(thing))
end
Then /^the inflated response should respond to '(.+)' with '(.+)'$/ do |method, to_match|