diff options
author | Grégoire Seux <g.seux@criteo.com> | 2017-03-01 18:00:31 +0100 |
---|---|---|
committer | Grégoire Seux <g.seux@criteo.com> | 2017-03-06 12:00:35 +0100 |
commit | d51d31cf0c514d353cc6883a4af77c11fe802ee9 (patch) | |
tree | 28f0102177e931cd6c1578814e8fd1953da6cb7a /spec/integration/knife | |
parent | 215c81dcfee22147a447e4f6846c975215d11679 (diff) | |
download | chef-d51d31cf0c514d353cc6883a4af77c11fe802ee9.tar.gz |
Ensure ruby nodes are supported in knife serve
Change-Id: I4788cac16864c7eb5a876890e9fe41485af80d46
Signed-off-by: Grégoire Seux <g.seux@criteo.com>
Diffstat (limited to 'spec/integration/knife')
-rw-r--r-- | spec/integration/knife/serve_spec.rb | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/spec/integration/knife/serve_spec.rb b/spec/integration/knife/serve_spec.rb index f03b5b99e8..b0cdd8c070 100644 --- a/spec/integration/knife/serve_spec.rb +++ b/spec/integration/knife/serve_spec.rb @@ -54,18 +54,28 @@ describe "knife serve", :workstation do when_the_repository "also has one of each thing" do before do - file "nodes/x.json", { "foo" => "bar" } + file "nodes/a_node_in_json.json", { "foo" => "bar" } + file "nodes/a_node_in_ruby.rb", "name 'a_node_in_ruby'" file "roles/a_role_in_json.json", { "foo" => "bar" } file "roles/a_role_in_ruby.rb", "name 'a_role_in_ruby'" end - it "knife serve serves up /nodes/x" do - with_knife_serve do |api| - expect(api.get("nodes/x")["name"]).to eq("x") + %w{a_node_in_json a_node_in_ruby}.each do |file_type| + context file_type do + it "knife serve serves up /nodes" do + with_knife_serve do |api| + expect(api.get("nodes")).to have_key(file_type) + end + end + it "knife serve serves up /nodes/#{file_type}" do + with_knife_serve do |api| + expect(api.get("nodes/#{file_type}")["name"]).to eq(file_type) + end + end end end - %w(a_role_in_json a_role_in_ruby).each do |file_type| + %w{a_role_in_json a_role_in_ruby}.each do |file_type| context file_type do it "knife serve serves up /roles" do with_knife_serve do |api| @@ -74,7 +84,7 @@ describe "knife serve", :workstation do end it "knife serve serves up /roles/#{file_type}" do with_knife_serve do |api| - expect(api.get("roles/#{file_type}")['name']).to eq(file_type) + expect(api.get("roles/#{file_type}")["name"]).to eq(file_type) end end end |