From 714901023e8a022d942158cf6169b34ff7beaf2d Mon Sep 17 00:00:00 2001 From: Brandon Robins Date: Wed, 31 Jan 2018 22:18:43 -0600 Subject: [PATCH] Return live and dead properties for `allprop` --- lib/calligraphy/resource/file_resource.rb | 4 ++++ spec/requests/propfind_spec.rb | 9 ++++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/lib/calligraphy/resource/file_resource.rb b/lib/calligraphy/resource/file_resource.rb index 0e24186..6ea7b22 100644 --- a/lib/calligraphy/resource/file_resource.rb +++ b/lib/calligraphy/resource/file_resource.rb @@ -552,6 +552,10 @@ module Calligraphy properties[node.name.to_sym] = node end + + (DAV_PROPERTY_METHODS - %w[allprop propname]).each do |property| + properties[property.to_sym] = send property, xml_node(property) + end end end diff --git a/spec/requests/propfind_spec.rb b/spec/requests/propfind_spec.rb index 5faa422..8d0f945 100644 --- a/spec/requests/propfind_spec.rb +++ b/spec/requests/propfind_spec.rb @@ -31,16 +31,23 @@ RSpec.describe 'PROPFIND', type: :request do end describe 'allprop' do - it 'returns all property names and values' do + it 'returns all live and dead properties' do propfind '/webdav/bar.html', headers: { RAW_POST_DATA: Support::Examples::Propfind.allprop } + property_methods = Calligraphy::FileResource::DAV_PROPERTY_METHODS - + %w[allprop propname] + expect(response.status).to eq(207) expect(response.body).to include('Authors') expect(response.body).to include('Author>') expect(response.body).to include('Jim') expect(response.body).to include('Roy') + + property_methods.each do |property_method| + expect(response.body).to include(property_method) + end end end